SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


fill a pdf form with data


fill a pdf form with data

Author
Message
sam-433147
sam-433147
Old Hand
Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)

Group: General Forum Members
Points: 309 Visits: 153
what can be done in access to fill a pdf form with data stored in access?
bledu
bledu
SSCrazy
SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)

Group: General Forum Members
Points: 2983 Visits: 104

some developers usually create their forms using e.g. word and then print it to a pdf printer. the reason being the ease of use of the the apis that are available




Everything you can imagine is real.

bledu
bledu
SSCrazy
SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)

Group: General Forum Members
Points: 2983 Visits: 104
you would need to get the pdf form API/component/ DLL


Everything you can imagine is real.

sam-433147
sam-433147
Old Hand
Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)Old Hand (309 reputation)

Group: General Forum Members
Points: 309 Visits: 153

where can i get the pdf form API/component/ DLL?

is it free?


bledu
bledu
SSCrazy
SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)

Group: General Forum Members
Points: 2983 Visits: 104

you can try cute pdf, but its not free http://www.cutepdf.com/ pdf sdk

from their sample code you will be doing something similar to

Dim objMyForm

Set objMyForm = Server.CreateObject("CutePDF.Document") 'Create form object

objMyForm.initialize("FS20-001-12345678-12345678") 'Initialize object by serial number of the license

'Open an encrypted PDF form file from an URL with password 'cutepdf'

if objMyForm.openFile("ftp://www.ftpsite.com/Encrypted_Form.pdf","cutepdf") = false then

errorMessage = objMyForm.GetLastError()

end if

'Set some value into fields

nReturn = objMyForm.setField("Company", "Acro Software Inc.")

nReturn = objMyForm.setField("Address.1", "Company address")

nReturn = objMyForm.setField("Address.2", "City, State, Zip")

nReturn = objMyForm.setField("Product", "CutePDF Form SDK")

'Save completed form file into a new PDF file

objMyForm.saveFile("D:\CutePDF SDK\Forms\Form01.pdf")

'Save a duplicate copy

objMyForm.saveFile("D:\CutePDF SDK\Forms\Form02.pdf")

----

which is your normal component usage




Everything you can imagine is real.

skb 44459
skb 44459
SSC Eights!
SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)

Group: General Forum Members
Points: 961 Visits: 297
Any way to convert the above vb code to sql
diana_criscione
diana_criscione
SSC Rookie
SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)

Group: General Forum Members
Points: 25 Visits: 33
I spent a fair amount of time researching this very thing and trying all sorts of VBA code. I have successfully created code that will open a PDF and then insert data from Access into the form-fillable PDF. Getting code samples from Acrobat forums is extremely difficult. It's as if Acrobat programmers don't like to share code.

That said, I've been wanting to share how I did it because I can't be the only one who needed this. Yes, Access can output to Word. Yes, Access can output a report as PDF. But what if the PDF is not your creation? What if you just need to populate it with data you have in your database?

I am using Adobe Acrobat X Standard. I have a couple of ways I populate PDFs with data.
1. pass an array of values to the procedure that populates the PDF and loop thru the array to insert the data
2. use recordset and get data, then hard code the names of the PDF fields and populate them
3. use a table to store the field mapping so that I can use a loop to populate the PDF fields with the corresponding Access data

I work PT for an insurance brokerage so some of the forms I'm populating are called ACORD apps. You do NOT want to recreate these in Access so populating a PDF is 100x easier.

I'm attaching a text file with the various code samples. It's all VBA code so it can be pasted into a new module. It will have to be modified quite a bit to meet your needs, but it's a start. Here's a basic sample:

' VERY BASIC EXAMPLE OF INSERTING DATA IN A PDF

Public Sub PopulateCertHolder(ByVal sValue As String, ByVal sAcord As String, ByVal sSaveAs As String)
Dim WshShell As Object

On Error GoTo PopulateCertHolder_Error

'open pdf fillable form
1 Set WshShell = CreateObject("Wscript.Shell")
2 WshShell.Run "Acrobat.exe " & sAcord

'delay to let the form load completely
3 PauseTime = 1
4 Start = Timer
5 Do While Timer < Start + PauseTime
6 DoEvents
7 Loop

8 Set APP = CreateObject("Acroexch.app")
9 Set AVDOC = CreateObject("AcroExch.AVDoc")
10 Set AVDOC = APP.GetActiveDoc
11 Set PDDOC = AVDOC.GetPDDoc
12 Set jso = PDDOC.GetJSObject

'populate fields
Dim val As Variant
18 Set x = jso.GetField("FormFieldName")
19 val = sValue
23 x.Value = val

'save file
31 PDDOC.Save 1, sSaveAs
32 AVDOC.Close 1
DoEvents
33 APP.CloseAllDocs
DoEvents
34 APP.Exit

'just in case window didn't close
35 fCloseApp "AcrobatSDIWindow"

'housekeeping on the way out
36 Set APP = Nothing
37 Set AVDOC = Nothing
38 Set PDDOC = Nothing
39 Set jso = Nothing

Exit_PopulateCertHolder:
Exit Sub

PopulateCertHolder_Error:
Call LogError(Err.Number, Err.Description, "AcrobatCode.PopulateCertHolder", Erl)
Resume Exit_PopulateCertHolder
End Sub


Hope this helps!
Diana
Attachments
AcrobatCode.txt (103 views, 19.00 KB)
aprilevans587
aprilevans587
SSC Rookie
SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)

Group: General Forum Members
Points: 26 Visits: 13
diana_criscione (12/24/2013)

That said, I've been wanting to share how I did it because I can't be the only one who needed this. Yes, Access can output to Word. Yes, Access can output a report as PDF. But what if the PDF is not your creation? What if you just need to populate it with data you have in your database?


Diana, thank you so so so much for sharing your findings with us. It definitely helps a lot.:-) I saves us much time in searching and reading each related topics.:-P
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search