Solved

Use VB6 to Populate PDF Form Fields

Posted on 2008-10-07
4
2,030 Views
Last Modified: 2013-11-27
I found the following sample code which should allow me to populate a PDF form field from VB6.  

When I run this code I get "Error 424: Object Required" on the "Set objField = jso.getField("TextField1")" line of code.  The field I'm trying to populate is TextField1.  I confirmed that field is the proper name on my PDF form.  I added a reference to Adobe Acrobat 7.0 Type Library.  I'm using Adobe Designer v7 to create my form.  I've seen other questions similar to this but none have really helped.  Any advice on how to correct this issue or sample code someone can share is greatly appreciated.  
Dim gApp As Acrobat.CAcroApp

    Dim gPDDoc As Acrobat.CAcroPDDoc

    Dim jso As Object

    Dim objField As Object
 

    Set gApp = CreateObject("AcroExch.App")

    Set gPDDoc = CreateObject("AcroExch.PDDoc")
 

'populate Data

    If gPDDoc.Open("Path") Then

        Set jso = gPDDoc.GetJSObject

        Set objField = jso.getField("TextField1")

        Set objField.Value = "value"

    End If

Open in new window

0
Comment
Question by:whymepa
  • 2
4 Comments
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 500 total points
ID: 22658341
The code you posted is for forms created in Acrobat (so called AcroForms). Designer creates XML forms that are wrapped in PDF, these forms are not compatible with AcroForms.

I don't know how to fill in Designer forms. Is there a reason why you are not using AcroForms?
0
 

Author Comment

by:whymepa
ID: 22658747
Thanka for the quick response.  My knowledge of Adobe is very limited.  Based on your comment I created a new PDF and added a new field called text1.  I added the field by going to Tools -> Advanced Editing -> Text Field Tool.  I adjusted my code accordingly based on the control being named text1.  When I run the code I no longer receive my original message.  Now I get the same error on "Set objField.Value = "value"".  Any idea or samples you can provide me to get around this?  I appreciate the assistance.
0
 

Author Comment

by:whymepa
ID: 22659408
Figured it out.  Last line of code should be: objField.Value = "value".

Thanks for the guidance!
0
 

Expert Comment

by:beechdriver100
ID: 33933919
I am in the same place that this user is in-very limited on Adobe forms. I've done this on WORD forms with success.

Does anybody know the code for how to then 'view' the form?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows Process running 3 48
A PDF to HTML file converter 2 110
Delphi Mdi application Child forms get behind control 7 162
Adobe Reader DC RdrCEF.EXE Application Error 4 679
The ability to edit PDF documents can be useful, however it may not be a straight forward process. Many non-technical people don't realise that a PDF document is basically an image rather than a text file, even if it contains nothing but text. If…
PaperPort is a popular document imaging/management product from Nuance Communications (http://www.nuance.com/). It is in widespread use by both individuals (http://www.nuance.com/for-individuals/by-product/paperport/index.htm) and businesses (http:/…
In this first video of the three-part Xpdf series, we introduce and describe Xpdf, a library containing nine command line utilities that perform various functions on PDF files. We show where the library is located and how to download it, discuss its…
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now