acrobat 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Guardfile +28 -30
- data/{LICENSE.adoc → LICENSE.txt} +3 -4
- data/README.md +107 -0
- data/Rakefile +6 -54
- data/examples/6030.17.antenna.pdf +0 -0
- data/examples/6030.17.cm300.tx.pdf +0 -0
- data/examples/form_field.rb +21 -0
- data/examples/merge.rb +11 -0
- data/lib/acrobat/app.rb +172 -187
- data/lib/acrobat/jso.rb +87 -94
- data/lib/acrobat/pdoc.rb +134 -137
- data/lib/acrobat/version.rb +5 -0
- data/lib/acrobat.rb +45 -48
- data/samples_other/background.js +40 -0
- data/samples_other/find_word.vb +440 -0
- data/samples_other/form.vb +393 -0
- data/vba/overlay.vba +40 -0
- metadata +27 -190
- data/.gitignore +0 -32
- data/History.adoc +0 -6
- data/Manifest.txt +0 -14
- data/README.adoc +0 -117
- data/bin/acrobat +0 -3
- data/test/acrobat_test.rb +0 -36
- data/test/test_helper.rb +0 -13
@@ -0,0 +1,393 @@
|
|
1
|
+
Option Strict Off
|
2
|
+
Option Explicit On
|
3
|
+
Friend Class FormsAutomation
|
4
|
+
Inherits System.Windows.Forms.Form
|
5
|
+
#Region "Windows Form Designer generated code "
|
6
|
+
Public Sub New()
|
7
|
+
MyBase.New()
|
8
|
+
If m_vb6FormDefInstance Is Nothing Then
|
9
|
+
If m_InitializingDefInstance Then
|
10
|
+
m_vb6FormDefInstance = Me
|
11
|
+
Else
|
12
|
+
Try
|
13
|
+
'For the start-up form, the first instance created is the default instance.
|
14
|
+
If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
|
15
|
+
m_vb6FormDefInstance = Me
|
16
|
+
End If
|
17
|
+
Catch
|
18
|
+
End Try
|
19
|
+
End If
|
20
|
+
End If
|
21
|
+
'This call is required by the Windows Form Designer.
|
22
|
+
InitializeComponent()
|
23
|
+
End Sub
|
24
|
+
'Form overrides dispose to clean up the component list.
|
25
|
+
Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
|
26
|
+
If Disposing Then
|
27
|
+
If Not components Is Nothing Then
|
28
|
+
components.Dispose()
|
29
|
+
End If
|
30
|
+
End If
|
31
|
+
MyBase.Dispose(Disposing)
|
32
|
+
End Sub
|
33
|
+
'Required by the Windows Form Designer
|
34
|
+
Private components As System.ComponentModel.IContainer
|
35
|
+
Public ToolTip1 As System.Windows.Forms.ToolTip
|
36
|
+
Public WithEvents ExitButton As System.Windows.Forms.Button
|
37
|
+
Public WithEvents StatusBox As System.Windows.Forms.TextBox
|
38
|
+
Public WithEvents CreateFieldsButton As System.Windows.Forms.Button
|
39
|
+
Public WithEvents StatusLabel As System.Windows.Forms.Label
|
40
|
+
'NOTE: The following procedure is required by the Windows Form Designer
|
41
|
+
'It can be modified using the Windows Form Designer.
|
42
|
+
'Do not modify it using the code editor.
|
43
|
+
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
|
44
|
+
Me.components = New System.ComponentModel.Container
|
45
|
+
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
|
46
|
+
Me.ExitButton = New System.Windows.Forms.Button
|
47
|
+
Me.StatusBox = New System.Windows.Forms.TextBox
|
48
|
+
Me.CreateFieldsButton = New System.Windows.Forms.Button
|
49
|
+
Me.StatusLabel = New System.Windows.Forms.Label
|
50
|
+
Me.SuspendLayout()
|
51
|
+
'
|
52
|
+
'ExitButton
|
53
|
+
'
|
54
|
+
Me.ExitButton.BackColor = System.Drawing.SystemColors.Control
|
55
|
+
Me.ExitButton.Cursor = System.Windows.Forms.Cursors.Default
|
56
|
+
Me.ExitButton.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
57
|
+
Me.ExitButton.ForeColor = System.Drawing.SystemColors.ControlText
|
58
|
+
Me.ExitButton.Location = New System.Drawing.Point(152, 15)
|
59
|
+
Me.ExitButton.Name = "ExitButton"
|
60
|
+
Me.ExitButton.RightToLeft = System.Windows.Forms.RightToLeft.No
|
61
|
+
Me.ExitButton.Size = New System.Drawing.Size(113, 25)
|
62
|
+
Me.ExitButton.TabIndex = 3
|
63
|
+
Me.ExitButton.Text = "Exit"
|
64
|
+
Me.ExitButton.UseVisualStyleBackColor = False
|
65
|
+
'
|
66
|
+
'StatusBox
|
67
|
+
'
|
68
|
+
Me.StatusBox.AcceptsReturn = True
|
69
|
+
Me.StatusBox.BackColor = System.Drawing.SystemColors.ButtonFace
|
70
|
+
Me.StatusBox.Cursor = System.Windows.Forms.Cursors.IBeam
|
71
|
+
Me.StatusBox.Enabled = False
|
72
|
+
Me.StatusBox.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
73
|
+
Me.StatusBox.ForeColor = System.Drawing.SystemColors.WindowText
|
74
|
+
Me.StatusBox.Location = New System.Drawing.Point(64, 56)
|
75
|
+
Me.StatusBox.MaxLength = 0
|
76
|
+
Me.StatusBox.Name = "StatusBox"
|
77
|
+
Me.StatusBox.ReadOnly = True
|
78
|
+
Me.StatusBox.RightToLeft = System.Windows.Forms.RightToLeft.No
|
79
|
+
Me.StatusBox.Size = New System.Drawing.Size(200, 19)
|
80
|
+
Me.StatusBox.TabIndex = 1
|
81
|
+
'
|
82
|
+
'CreateFieldsButton
|
83
|
+
'
|
84
|
+
Me.CreateFieldsButton.BackColor = System.Drawing.SystemColors.Control
|
85
|
+
Me.CreateFieldsButton.Cursor = System.Windows.Forms.Cursors.Default
|
86
|
+
Me.CreateFieldsButton.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
87
|
+
Me.CreateFieldsButton.ForeColor = System.Drawing.SystemColors.ControlText
|
88
|
+
Me.CreateFieldsButton.Location = New System.Drawing.Point(16, 15)
|
89
|
+
Me.CreateFieldsButton.Name = "CreateFieldsButton"
|
90
|
+
Me.CreateFieldsButton.RightToLeft = System.Windows.Forms.RightToLeft.No
|
91
|
+
Me.CreateFieldsButton.Size = New System.Drawing.Size(113, 25)
|
92
|
+
Me.CreateFieldsButton.TabIndex = 0
|
93
|
+
Me.CreateFieldsButton.Text = "Create Fields"
|
94
|
+
Me.CreateFieldsButton.UseVisualStyleBackColor = False
|
95
|
+
'
|
96
|
+
'StatusLabel
|
97
|
+
'
|
98
|
+
Me.StatusLabel.BackColor = System.Drawing.SystemColors.Control
|
99
|
+
Me.StatusLabel.Cursor = System.Windows.Forms.Cursors.Default
|
100
|
+
Me.StatusLabel.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
101
|
+
Me.StatusLabel.ForeColor = System.Drawing.SystemColors.ControlText
|
102
|
+
Me.StatusLabel.Location = New System.Drawing.Point(16, 58)
|
103
|
+
Me.StatusLabel.Name = "StatusLabel"
|
104
|
+
Me.StatusLabel.RightToLeft = System.Windows.Forms.RightToLeft.No
|
105
|
+
Me.StatusLabel.Size = New System.Drawing.Size(40, 17)
|
106
|
+
Me.StatusLabel.TabIndex = 2
|
107
|
+
Me.StatusLabel.Text = "Status:"
|
108
|
+
'
|
109
|
+
'FormsAutomation
|
110
|
+
'
|
111
|
+
Me.AcceptButton = Me.ExitButton
|
112
|
+
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
|
113
|
+
Me.BackColor = System.Drawing.SystemColors.Control
|
114
|
+
Me.ClientSize = New System.Drawing.Size(281, 89)
|
115
|
+
Me.Controls.Add(Me.ExitButton)
|
116
|
+
Me.Controls.Add(Me.StatusBox)
|
117
|
+
Me.Controls.Add(Me.CreateFieldsButton)
|
118
|
+
Me.Controls.Add(Me.StatusLabel)
|
119
|
+
Me.Cursor = System.Windows.Forms.Cursors.Default
|
120
|
+
Me.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
121
|
+
Me.Location = New System.Drawing.Point(11, 30)
|
122
|
+
Me.MaximizeBox = False
|
123
|
+
Me.Name = "FormsAutomation"
|
124
|
+
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
|
125
|
+
Me.Text = "Acrobat Forms Automation Demo"
|
126
|
+
Me.ResumeLayout(False)
|
127
|
+
|
128
|
+
End Sub
|
129
|
+
#End Region
|
130
|
+
#Region "Upgrade Support "
|
131
|
+
Private Shared m_vb6FormDefInstance As FormsAutomation
|
132
|
+
Private Shared m_InitializingDefInstance As Boolean
|
133
|
+
Public Shared Property DefInstance() As FormsAutomation
|
134
|
+
Get
|
135
|
+
If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
|
136
|
+
m_InitializingDefInstance = True
|
137
|
+
m_vb6FormDefInstance = New FormsAutomation()
|
138
|
+
m_InitializingDefInstance = False
|
139
|
+
End If
|
140
|
+
DefInstance = m_vb6FormDefInstance
|
141
|
+
End Get
|
142
|
+
Set
|
143
|
+
m_vb6FormDefInstance = Value
|
144
|
+
End Set
|
145
|
+
End Property
|
146
|
+
#End Region
|
147
|
+
|
148
|
+
' ADOBE SYSTEMS INCORPORATED
|
149
|
+
' Copyright (C) 1994-2003 Adobe Systems Incorporated
|
150
|
+
' All rights reserved.
|
151
|
+
'
|
152
|
+
' NOTICE: Adobe permits you to use, modify, and distribute this file
|
153
|
+
' in accordance with the terms of the Adobe license agreement
|
154
|
+
' accompanying it. If you have received this file from a source other
|
155
|
+
' than Adobe, then your use, modification, or distribution of it
|
156
|
+
' requires the prior written permission of Adobe.
|
157
|
+
'
|
158
|
+
' -------------------------------------------------------------------
|
159
|
+
'
|
160
|
+
' FormsAutomation.vbp
|
161
|
+
'
|
162
|
+
' - The application shows how to add Text boxes, combo boxes, radio
|
163
|
+
' buttons and action buttons to a PDF. In this case, the PDF is
|
164
|
+
' empty and we are adding form fields to it.
|
165
|
+
'
|
166
|
+
' - To run the sample:
|
167
|
+
'
|
168
|
+
' Run the sample and click on the Create Fields button. The
|
169
|
+
' sample will open the IAC\TestFiles\FormsAutomation.pdf file
|
170
|
+
' in Acrobat and add form fields to it.
|
171
|
+
|
172
|
+
|
173
|
+
Dim formApp As AFORMAUTLib.AFormApp
|
174
|
+
Dim acroForm As AFORMAUTLib.Fields
|
175
|
+
Dim field As AFORMAUTLib.Field
|
176
|
+
Dim bOK As Boolean
|
177
|
+
Dim avDoc As Acrobat.CAcroAVDoc
|
178
|
+
Dim pdDoc As Acrobat.CAcroPDDoc
|
179
|
+
Dim radiobuttonArray(5) As String
|
180
|
+
|
181
|
+
Private Sub CreateFieldsButton_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CreateFieldsButton.Click
|
182
|
+
|
183
|
+
'Set the mouse icon to display an hourglass
|
184
|
+
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
|
185
|
+
|
186
|
+
'Disable the create fields button
|
187
|
+
CreateFieldsButton.Enabled = False
|
188
|
+
|
189
|
+
'Update the status box
|
190
|
+
StatusBox.Text = "Opening PDF Document..."
|
191
|
+
|
192
|
+
' Open the sample PDF file
|
193
|
+
avDoc = CreateObject("AcroExch.AVDoc")
|
194
|
+
Dim file As String = System.Windows.Forms.Application.StartupPath & "\..\..\..\..\TestFiles\FormsAutomation.pdf"
|
195
|
+
|
196
|
+
bOK = avDoc.Open(file, "Forms Automation Demo")
|
197
|
+
|
198
|
+
'If everything was OK opening the PDF, we now instantiate the Forms
|
199
|
+
'Automation object.
|
200
|
+
If (bOK) Then
|
201
|
+
formApp = CreateObject("AFormAut.App")
|
202
|
+
acroForm = formApp.Fields
|
203
|
+
Else
|
204
|
+
System.Runtime.InteropServices.Marshal.ReleaseComObject(avDoc)
|
205
|
+
avDoc = Nothing
|
206
|
+
MsgBox("Failed to open PDF Document. Aborting...")
|
207
|
+
End
|
208
|
+
End If
|
209
|
+
|
210
|
+
'Update the status box
|
211
|
+
StatusBox.Text = "Creating Form Fields..."
|
212
|
+
|
213
|
+
'Add a Text Field to the PDF
|
214
|
+
' Fields.Add takes seven parameters:
|
215
|
+
' FieldName is the The fully-qualified name of the field.
|
216
|
+
' FieldType is the field type for the newly created field. Valid types are:
|
217
|
+
' "text", "button", "combobox", "listbox", "checkbox", "radiobutton".
|
218
|
+
' You must spell the field type names exactly as shown, including
|
219
|
+
' use the quotation marks.
|
220
|
+
' PageNum is the zero-based page number to add the field to.
|
221
|
+
' Left A float for the left most position of the rectangle placement.
|
222
|
+
' Top A float for the top of the rectangle placement.
|
223
|
+
' Right A float for the right most position of the rectangle placement.
|
224
|
+
' Bottom A float for the bottom of the rectangle placement.
|
225
|
+
field = acroForm.Add("Name", "text", 0, 100, 650, 450, 675)
|
226
|
+
|
227
|
+
'Next use Field.SetBorderColor to set the color of the fields borders in
|
228
|
+
'Gray scale, Transparent, RGB or CMYK color. All values are floating point numbers
|
229
|
+
'between 0 and 1. In the example below, we are using RGB color space. So the last
|
230
|
+
'parameter is set to "0"
|
231
|
+
field.SetBorderColor("RGB", 0.7, 0.5, 0.3, 0)
|
232
|
+
|
233
|
+
'Field.TextSize sets the font size of the field. You can also use Field.TextFont
|
234
|
+
'to use a specific font. See the Acrobat Forms API Reference for more information
|
235
|
+
'on various font names.
|
236
|
+
field.TextSize = CShort("12")
|
237
|
+
'field.TextFont = "Times-Roman"
|
238
|
+
|
239
|
+
'You can use Field.DefaultValue to set the default value of a field.
|
240
|
+
field.DefaultValue = "Enter your full name here"
|
241
|
+
|
242
|
+
'Create a date field formatted to be "mm/dd/yyyy". The SetJavaScriptAction
|
243
|
+
'method sets the keystoke and format properties to the proper date format
|
244
|
+
'using JavaScript
|
245
|
+
field = acroForm.Add("Creation Date", "text", 0, 375, 680, 450, 715)
|
246
|
+
field.SetBorderColor("RGB", 0.7, 0.5, 0.3, 0)
|
247
|
+
field.TextSize = CShort("12")
|
248
|
+
field.DefaultValue = "01/01/2000"
|
249
|
+
field.SetJavaScriptAction("keystroke", "AFDate_KeystrokeEx(""mm/dd/yyyy"");")
|
250
|
+
field.SetJavaScriptAction("format", "AFDate_FormatEx(""mm/dd/yyyy"");")
|
251
|
+
|
252
|
+
'Now add a few more fields for address, city, state, zip code. The zip code
|
253
|
+
'field introduces a new functionality - using JavaScript to format the
|
254
|
+
'field values.
|
255
|
+
field = acroForm.Add("Address", "text", 0, 100, 620, 450, 645)
|
256
|
+
field.SetBorderColor("RGB", 0.7, 0.5, 0.3, 0)
|
257
|
+
field.TextSize = CShort("12")
|
258
|
+
field.DefaultValue = "Enter your address here"
|
259
|
+
|
260
|
+
field = acroForm.Add("City", "text", 0, 100, 590, 345, 615)
|
261
|
+
field.SetBorderColor("RGB", 0.7, 0.5, 0.3, 0)
|
262
|
+
field.TextSize = CShort("12")
|
263
|
+
field.DefaultValue = "Enter your City"
|
264
|
+
|
265
|
+
field = acroForm.Add("State", "text", 0, 350, 590, 375, 615)
|
266
|
+
field.SetBorderColor("RGB", 0.7, 0.5, 0.3, 0)
|
267
|
+
field.TextSize = CShort("12")
|
268
|
+
field.DefaultValue = "CA"
|
269
|
+
|
270
|
+
field = acroForm.Add("Zip", "text", 0, 385, 590, 450, 615)
|
271
|
+
field.SetBorderColor("RGB", 0.7, 0.5, 0.3, 0)
|
272
|
+
field.TextSize = CShort("12")
|
273
|
+
field.DefaultValue = "99999"
|
274
|
+
field.SetJavaScriptAction("keystroke", "AFSpecial_Keystroke(0);")
|
275
|
+
field.SetJavaScriptAction("format", "AFSpecial_Format(0);")
|
276
|
+
|
277
|
+
'To create a series of radio buttons. Create the field, then call
|
278
|
+
'Fields.Add again to create the children
|
279
|
+
field = acroForm.Add("Radio", "radiobutton", 0, 150, 500, 165, 515)
|
280
|
+
field.SetBorderColor("RGB", 0.75, 0.55, 0.35, 0)
|
281
|
+
|
282
|
+
field = acroForm.Add("Radio", "radiobutton", 0, 180, 500, 195, 515)
|
283
|
+
field.SetBorderColor("RGB", 0.75, 0.55, 0.35, 0)
|
284
|
+
|
285
|
+
field = acroForm.Add("Radio", "radiobutton", 0, 210, 500, 225, 515)
|
286
|
+
field.SetBorderColor("RGB", 0.75, 0.55, 0.35, 0)
|
287
|
+
|
288
|
+
field = acroForm.Add("Radio", "radiobutton", 0, 240, 500, 255, 515)
|
289
|
+
field.SetBorderColor("RGB", 0.75, 0.55, 0.35, 0)
|
290
|
+
|
291
|
+
field = acroForm.Add("Radio", "radiobutton", 0, 270, 500, 285, 515)
|
292
|
+
field.SetBorderColor("RGB", 0.75, 0.55, 0.35, 0)
|
293
|
+
|
294
|
+
'Build an array then call SetExportValues
|
295
|
+
radiobuttonArray(0) = "Red"
|
296
|
+
radiobuttonArray(1) = "Green"
|
297
|
+
radiobuttonArray(2) = "Blue"
|
298
|
+
radiobuttonArray(3) = "Yellow"
|
299
|
+
radiobuttonArray(4) = "Black"
|
300
|
+
radiobuttonArray(5) = "White"
|
301
|
+
field.SetExportValues(radiobuttonArray)
|
302
|
+
|
303
|
+
'Create a list box. This section of code will create a list box on the
|
304
|
+
'PDF and populate the list box with items.
|
305
|
+
field = acroForm.Add("My Combo Box", "combobox", 0, 100, 450, 380, 475)
|
306
|
+
field.SetBorderColor("RGB", 0.75, 0.55, 0.35, 0)
|
307
|
+
field.TextSize = CShort("12")
|
308
|
+
|
309
|
+
'Now that the list box is complete, let's build two arrays that
|
310
|
+
'will be used to populate the list box.
|
311
|
+
'First is an array of items that will be displayed to the user
|
312
|
+
Dim arrayOfItems(4) As String
|
313
|
+
arrayOfItems(0) = "[Choose an item from the list]"
|
314
|
+
arrayOfItems(1) = "Bird"
|
315
|
+
arrayOfItems(2) = "Cat"
|
316
|
+
arrayOfItems(3) = "Dog"
|
317
|
+
arrayOfItems(4) = "Gold Fish"
|
318
|
+
|
319
|
+
'Then the exported value that will come back in the FDF
|
320
|
+
Dim arrayOfExportValues(4) As String
|
321
|
+
arrayOfExportValues(0) = "X"
|
322
|
+
arrayOfExportValues(1) = "a"
|
323
|
+
arrayOfExportValues(2) = "b"
|
324
|
+
arrayOfExportValues(3) = "c"
|
325
|
+
arrayOfExportValues(4) = "d"
|
326
|
+
|
327
|
+
'Next, use the PopulateListOrComboBox method to add values into the
|
328
|
+
'combo box
|
329
|
+
field.PopulateListOrComboBox(arrayOfItems, arrayOfExportValues)
|
330
|
+
|
331
|
+
'Now, create a new submit button for the user to click on. Set the border
|
332
|
+
'style, the button caption, the color of the background. Field.Highlight sets
|
333
|
+
'the property of the button to look like it was pushed in.
|
334
|
+
field = acroForm.Add("Submit Button", "button", 0, 100, 50, 150, 100)
|
335
|
+
field.BorderStyle = "beveled"
|
336
|
+
field.SetButtonCaption("N", "Submit")
|
337
|
+
field.SetBackgroundColor("G", 0.85, 0.85, 0, 0)
|
338
|
+
field.Highlight = "push"
|
339
|
+
|
340
|
+
'Set the SubmitForm action to point to a web server.
|
341
|
+
field.SetSubmitFormAction("up", "http://your-webserver.com/cgi-bin/myscript", 0)
|
342
|
+
|
343
|
+
'Create a reset button just in case users want to change there minds a
|
344
|
+
'reset all the fields on the newly created PDF.
|
345
|
+
field = acroForm.Add("Reset Button", "button", 0, 175, 50, 225, 100)
|
346
|
+
field.BorderStyle = "beveled"
|
347
|
+
field.SetButtonCaption("N", "Reset")
|
348
|
+
field.SetBackgroundColor("G", 0.85, 0.85, 0, 0)
|
349
|
+
field.Highlight = "push"
|
350
|
+
'Set the ResetForm action for the button.
|
351
|
+
field.SetResetFormAction("up", 0)
|
352
|
+
|
353
|
+
'Update the Status box.
|
354
|
+
StatusBox.Text = "Fields have been added successfully."
|
355
|
+
|
356
|
+
'This section converts a AVDoc to a PDDoc. Then we use PDDoc.Save to
|
357
|
+
'save the PDF since there isn't a viewer level method to save an AVDoc.
|
358
|
+
|
359
|
+
'These lines are commented out to provide user feedback
|
360
|
+
'If present, no doc is visible and original form is changed
|
361
|
+
'so it isn't obvious what the sample did, and it doesn't work
|
362
|
+
'twice in a row.
|
363
|
+
'It's best to have Acrobat open and visible to see form creation
|
364
|
+
'''''''''
|
365
|
+
'Set pdDoc = avDoc.GetPDDoc
|
366
|
+
'bOK = pdDoc.Save(1, "C:\FormsAutomation.pdf")
|
367
|
+
'If bOK = False Then
|
368
|
+
'MsgBox "Unable to Save the PDF file"
|
369
|
+
'End If
|
370
|
+
|
371
|
+
' Close the AVDoc
|
372
|
+
'avDoc.Close (False)
|
373
|
+
'''''''''
|
374
|
+
'End provide User Feedback
|
375
|
+
|
376
|
+
CleanUp:
|
377
|
+
'Change the mouse pointer to display normal cursor and enable the Exit button
|
378
|
+
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
|
379
|
+
|
380
|
+
'Enable the create fields button
|
381
|
+
CreateFieldsButton.Enabled = True
|
382
|
+
End Sub
|
383
|
+
|
384
|
+
Private Sub ExitButton_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ExitButton.Click
|
385
|
+
' End the program
|
386
|
+
End
|
387
|
+
|
388
|
+
End Sub
|
389
|
+
|
390
|
+
Private Sub FormsAutomation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
391
|
+
StatusBox.Text = "Click Create Fields Button..."
|
392
|
+
End Sub
|
393
|
+
End Class
|
data/vba/overlay.vba
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
Private Function ApplyBackgroundToPDF(BasePDF As String, BackgroundPDF As String)
|
2
|
+
Dim pdDoc As Acrobat.CAcroPDDoc
|
3
|
+
Dim pdTemplate As Acrobat.CAcroPDDoc
|
4
|
+
Dim template As Variant
|
5
|
+
Dim lngPage As Long
|
6
|
+
|
7
|
+
'Open base document
|
8
|
+
Set pdDoc = CreateObject("AcroExch.PDDoc")
|
9
|
+
pdDoc.Open BasePDF
|
10
|
+
DoEvents
|
11
|
+
|
12
|
+
'Open background document
|
13
|
+
Set pdTemplate = CreateObject("AcroExch.PDDoc")
|
14
|
+
pdTemplate.Open BackgroundPDF
|
15
|
+
DoEvents
|
16
|
+
|
17
|
+
'Add background document to base document
|
18
|
+
pdDoc.InsertPages pdDoc.GetNumPages - 1, pdTemplate, 0, 1, 0
|
19
|
+
|
20
|
+
'Create a template from the inserted background document
|
21
|
+
Set template = pdDoc.GetJSObject.CreateTemplate("background", pdDoc.GetNumPages - 1)
|
22
|
+
|
23
|
+
'Place the template as a background to all pages
|
24
|
+
For lngPage = 0 To pdDoc.GetNumPages - 2
|
25
|
+
template.Spawn lngPage, True, True
|
26
|
+
Next
|
27
|
+
|
28
|
+
'Delete last page (used for template creation purposes only)
|
29
|
+
pdDoc.DeletePages pdDoc.GetNumPages - 1, pdDoc.GetNumPages - 1
|
30
|
+
|
31
|
+
'Save
|
32
|
+
pdDoc.Save 1, BasePDF
|
33
|
+
|
34
|
+
'Close & Destroy Objects
|
35
|
+
pdDoc.Close
|
36
|
+
Set pdDoc = Nothing
|
37
|
+
|
38
|
+
pdTemplate.Close
|
39
|
+
Set pdTemplate = Nothing
|
40
|
+
End Function
|
metadata
CHANGED
@@ -1,229 +1,66 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acrobat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- dsisnero
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
name: minitest
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '5.14'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '5.14'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: hoe-bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.4'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.4'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: hoe-yard
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0.1'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0.1'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: pry
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: pry-byebug
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: yard
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0.0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0.0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: guard
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0.0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0.0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: guard-minitest
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0.0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0.0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: asciidoctor
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0.0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0.0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: rdoc
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '4.0'
|
146
|
-
- - "<"
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
version: '7'
|
149
|
-
type: :development
|
150
|
-
prerelease: false
|
151
|
-
version_requirements: !ruby/object:Gem::Requirement
|
152
|
-
requirements:
|
153
|
-
- - ">="
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
version: '4.0'
|
156
|
-
- - "<"
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '7'
|
159
|
-
- !ruby/object:Gem::Dependency
|
160
|
-
name: hoe
|
161
|
-
requirement: !ruby/object:Gem::Requirement
|
162
|
-
requirements:
|
163
|
-
- - "~>"
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '3.22'
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
requirements:
|
170
|
-
- - "~>"
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: '3.22'
|
173
|
-
description: |-
|
174
|
-
<div class="paragraph">
|
175
|
-
<p>The acrobat gem is a library that uses WIN32OLE to automate pdf functions. Adobe Reader or Adobe Acrobat must be installed and then you can fill forms and merge documents</p>
|
176
|
-
</div>
|
11
|
+
date: 2024-08-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Merge PDFs fill in forms, from ruby
|
177
14
|
email:
|
178
15
|
- dsisnero@gmail.com
|
179
|
-
executables:
|
180
|
-
- acrobat
|
16
|
+
executables: []
|
181
17
|
extensions: []
|
182
|
-
extra_rdoc_files:
|
183
|
-
- Manifest.txt
|
18
|
+
extra_rdoc_files: []
|
184
19
|
files:
|
185
|
-
- ".
|
20
|
+
- ".standard.yml"
|
21
|
+
- CHANGELOG.md
|
22
|
+
- CODE_OF_CONDUCT.md
|
186
23
|
- Guardfile
|
187
|
-
-
|
188
|
-
-
|
189
|
-
- Manifest.txt
|
190
|
-
- README.adoc
|
24
|
+
- LICENSE.txt
|
25
|
+
- README.md
|
191
26
|
- Rakefile
|
192
|
-
-
|
27
|
+
- examples/6030.17.antenna.pdf
|
28
|
+
- examples/6030.17.cm300.tx.pdf
|
29
|
+
- examples/form_field.rb
|
30
|
+
- examples/merge.rb
|
193
31
|
- lib/acrobat.rb
|
194
32
|
- lib/acrobat/app.rb
|
195
33
|
- lib/acrobat/jso.rb
|
196
34
|
- lib/acrobat/pdoc.rb
|
197
|
-
-
|
198
|
-
-
|
35
|
+
- lib/acrobat/version.rb
|
36
|
+
- samples_other/background.js
|
37
|
+
- samples_other/find_word.vb
|
38
|
+
- samples_other/form.vb
|
39
|
+
- vba/overlay.vba
|
199
40
|
homepage: https://github.com/dsisnero/acrobat
|
200
41
|
licenses:
|
201
42
|
- MIT
|
202
43
|
metadata:
|
203
44
|
homepage_uri: https://github.com/dsisnero/acrobat
|
204
|
-
bug_tracker_uri: https://github.com/dsisnero/acrobat/issues
|
205
45
|
source_code_uri: https://github.com/dsisnero/acrobat
|
206
|
-
changelog_uri: https://github.com/dsisnero/acrobat/
|
46
|
+
changelog_uri: https://github.com/dsisnero/acrobat/CHANGELOG.md
|
207
47
|
post_install_message:
|
208
|
-
rdoc_options:
|
209
|
-
- "--main"
|
210
|
-
- README.adoc
|
48
|
+
rdoc_options: []
|
211
49
|
require_paths:
|
212
50
|
- lib
|
213
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
214
52
|
requirements:
|
215
53
|
- - ">="
|
216
54
|
- !ruby/object:Gem::Version
|
217
|
-
version:
|
55
|
+
version: 3.0.0
|
218
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
57
|
requirements:
|
220
58
|
- - ">="
|
221
59
|
- !ruby/object:Gem::Version
|
222
60
|
version: '0'
|
223
61
|
requirements: []
|
224
|
-
rubygems_version: 3.
|
62
|
+
rubygems_version: 3.5.17
|
225
63
|
signing_key:
|
226
64
|
specification_version: 4
|
227
|
-
summary:
|
228
|
-
to automate pdf functions
|
65
|
+
summary: Automate Adobe Acrobat from Ruby
|
229
66
|
test_files: []
|