Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PDF w/form fields View/Edit/Print Activex control 3

Status
Not open for further replies.

holzert

Programmer
Jul 30, 2001
26
US
VFP8. We are once again looking at editing PDF forms inside of VFP. We are currently testing the pdf.ocx from Adobe in conjuntion with Gnostice's pdftoolkit. I have looked at a couple of other options such as iSedQuickPDF.
Right now I am able to open a pdf file using Gnostice's pdftoolkit (the ocx is slapped on the VFP form) and programmatically populate the pdf formfields on the pdf form with data from our app using the Gnostice pdftoolkit. We then save the pdf form to disk and open it again in the form using the pdf.ocx. The Adobe pdf.ocx allows the user to edit the fields on the pdfform. If the pdf form is saved to disk, I can then grab the changes to
the formfields on the form using the Gnostice pdftoolkit and save those changes to tables in our app. The problem we are encountering is that the Adobe activex ocx will only save the changes to disk if the workstation has
the full version of Adobe Acrobat installed. If only Adobe Reader is installed then the pdf form is saved without any data. Of course, our goal is to capture the form field data changes and save those changes back to our app's tables. Since the Adobe ocx is providing the means of displaying and editing the pdf form fields, the Gnostice pdftoolkit on the form does not see the pdf form once it is loaded in the Adobe ocx (since it is in memory
and not stored to disk yet after the changes are made) or its values. The pdf toolkit can only grab the form field valus once the pdf form is saved to disk again after the changes are done. Then we run into the problem of requiring the full version of Adobe Acrobat on the workstations so the adobe pdf.ocx will save the form with the data to disk so the toolkit can read the changes. Any ideas? We could handle it with purchasing two separate pdf
tools if necessary. If that is the case, then we need a means of displaying the pdf form and allowing the user the means to edit the form fields on the pdf form, and then save the data to disk so the 2nd toolkit can readin the
changes.

Thanks for any ideas you may have!
 
[blue][]bTracy

Then we run into the problem of requiring the full version of Adobe Acrobat on the workstations so the adobe pdf.ocx will save the form with the data to disk so the toolkit can read the changes.

I haven't check with Adobe's website, but is it possible that you only need a freely distributable runtime file to achieve this action? Maybe a quick e-mail to thir suppor would confirm this.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Holzert,

We could handle it with purchasing two separate pdf
tools if necessary.


I don't think you have any choice. The whole point of the OCX is that it is a reader. You can't use it to write the updated data back to disk. You have to use the full Acrobat product to do that. That's how Adobe make their money.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Heya Holzert,

Not sure if this will help at all but I recently had a client which used the Gnositice product for updating PDF Form fields but has also needed the capability to create PDF documents from scratch based on a "template" his clients set up in a memo field.

I found the Amyuni PDFCreator...


.. worked well for this. As part of this product I believe you get a viewer and editor GUI. Maybe you could use that to allow users to edit in the PDF file itself.

HTH



Toodles,
Steve Dingle
D&S Business Solutions Ltd
 
Heya Mike,

I found the link to here on your site and have posted a coupla questions on the HTML/CSS forum. Figured I might as well poke my head into the VFP forums :) I do miss the OLR UI but this seems like a nice UI for forums

Will be see'in ya around I'm sure ;-)

Toodles,
Steve Dingle
D&S Business Solutions Ltd
 
For any lurkers, I found a way to do it using automation or javascript directly from VFP (see the SDK for more information)
<code>
*--This example reqs test.pdf with the following fieldnames (all are case sensitive):
* "AGENCY.NAME"
* "AGENCY.ADDR1"
* "AGENCY.CITYSTZIP"


sFieldName = "AGENCY.NAME"
sFieldName2 = "AGENCY.ADDR1"
sFieldName3 = "AGENCY.CITYSTZIP"

sfileName = "C:\acordforms\test\test.pdf"
IF !FILE(sFileName)
=MESSAGEBOX('Cannot locate: '+sfilename)
sFileName=GETFILE('pdf','PDF File:','Open',1,'Please select a pdf file with the formfield AGENCY.ADDR1')
IF !FILE(sFileName)
=MESSAGEBOX('Cannot locate: '+sfilename)
RETURN
ENDIF
ENDIF

AcroExchApp = CREATEOBJECT("AcroExch.App")
AcroExchAVDoc = CreateObject("AcroExch.AVDoc")
AcroExchAVDoc.Open(sFileName, "")
AcroForm = CreateObject("AFormAut.App")
AcroFields = AcroForm.Fields

*--Get the value of the first field AGENCY.NAME in our test.pdf
AcroField = AcroFields.Item(sFieldName)
*--Get the value of the 2nd field AGENCY.ADDR1 in our test.pdf
AcroField2 = AcroFields.Item(sFieldName2)

MESSAGEBOX(PADR(PADL("FORMFIELD AGENCY.NAME value:",40),80)+CHR(13)+AcroField.Value+CHR(13)+CHR(13);
+PADR(PADL("FORMFIELD AGENCY.ADDR1 value:",40),80)+CHR(13)+AcroField2.Value,0+64+4096,"Value Retrieved by Automation")

IF MESSAGEBOX('Print '+sFileName+'?',1+32+4096,'Send to Printer')=1
AcroExchAVDoc.PrintPages(0, 1, 2, .t., .f.)
ENDIF

*--Get the value of the citystzip formfield using javascript
sJS = "event.value = this.getField("+"'"+sFieldName3+"'"+").value;"
sValue = AcroForm.Fields.ExecuteThisJavaScript(sJS)

=MESSAGEBOX(PADR(PADL("AGENCY.CITYSTZIP value:",40),80)+CHR(13)+sValue+CHR(13),0+64+4096,"Value Retrieved by JavaScript")

*--Change the agency name and addr1 field values on the pdf form
Acrofield.value = "New Company Name"
Acrofield2.value = "New Street Address"

MESSAGEBOX(PADR(PADL("FORMFIELD AGENCY.NAME value:",40),80)+CHR(13)+AcroField.Value+CHR(13)+CHR(13);
+PADR(PADL("FORMFIELD AGENCY.ADDR1 value:",40),80)+CHR(13)+AcroField2.Value,0+64+4096,"Value Changed and Retrieved by Automation")

IF MESSAGEBOX('Print modified '+sFileName+'?',1+32+4096,'Send to Printer')=1
AcroExchAVDoc.PrintPages(0, 1, 2, .t., .f.)
ENDIF
AcroExchAVDoc.Close(.T.)
AcroExchApp.Exit
</code>
To step through all fields in a form and change the value if desired:
<code>
i = 0
FOR EACH Acrofield IN AcroForm.Fields
WITH AcroField
i = i + 1
DIMENSION fieldlist(i,2)
fieldlist(i,1)=acrofield.name
fieldlist(i,2)=acrofield.value
*--Change value if desired
*acrofield.value = "new value"
ENDWITH
ENDFOR
</code>
 
Tracy

Just a note on your tags, this site uses the square backets.

Thank you for the info.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks for the information on correct formatting for code. I didn't realize that I needed to use the square brackets. Can you fix it (replace < with square brackets)?

thanks,
Tracy
 
Tracy

Thanks for the information on correct formatting for code

At the bottom of a new message there is a link to "process TGML". If you click on the link it show you the basic use of tag formatting being used on this site.

Can you fix it (replace < with square brackets)?

Users do not have that hability, here. But don't worry your code is quite legible anyways. I have made that mistake many times here and at the "other place".

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top