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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP and fillable PDF form data 2

Status
Not open for further replies.

eboughey1008

Programmer
Jan 6, 2009
31
US

I don't see anything but has anyone been able to crack this?

My client has a fillable PDF form. I wanted to duplicate his setup and export all the fields through a program to a pdf file but he doesn't like that at all. The PDF becomes read only and they can no longer edit the PDF if they want to.

I think it's an exceedingly bad practice to manually input data when you have the resources to calculate it & update automatically but they still want the option to update so I've been looking around to see if there is anything I can do like export to a csv that the PDF reads..

Any info on where to look?

Thanks - Elena
 
That's no easy task, the only name that comes up is Amyuni. Not sure if that still exists and still integrates with VFP, I have a long time not seen anything about that.
FoxyPreviewer report apps use a pdf library to create PDF files, but they only make use of normal PDF generation, not PDF forms. Still, perhaps that library, the libhpdf.dll, has the feature to create such elements in a PDF, too. But you'd need to be the Neil Armstrong making first steps with that and VFP.

You will have a hard time making use of reports, as I don't see a way of making a report control a PDF form input control by any means of the reports native behavior and the only way to intercept what is generated is with report listener events. But the main option it allows you to do is render the element differently than the native report engine, ie generate graphical snippets the report engine than patches into the overall report.

So your idea to only contribute the data in some form is what I would also lookout for, you're looking for ways to automate an empty PDF form, don't you? And that cycles back to Amyuni, that was capable to do that.

Bye, Olaf.

Olaf Doschke Software Engineering
 
You could perhaps generate a 'lookalike' report using xfrx to output to a pdf filling in the fields you have in the database

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Hi Elena,

According to their website, the Amyuni PDF Suite can do this. See this page:
It explicitly states that the product can "Create and fill-out PDF forms", but gives no further details. The suite is not free, but you can get a 30-day free trial to try it out.

I used Amuyuni a few years ago in a VFP project. It worked fine with VFP, although I only used its basic features.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 

I was hoping to find a way to export the fields to a csv file & have the PDF form looking at those fields. Seems like something easy but Adobe isn't that technically advanced I guess.
 
Nope, the other way around.

open vfp, open pdf from vfp, scan database, insert fields, save pdf, close vfp

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
AS your entry point is a PDF form, I don't see how you could tell it to use a CSV file as a data source. The PDF would need to be like an Office document allowing data binding and allowing to set that in an already existing PDF document.

If you google PDF data binding you find something, but it's just PDF documents about data binding in programming, Java, JS; C#, etc, so Google finds PDF as the search result format, PDFs about data binding, not PDFs doing data binding.

As Griff says, you can automate the PDF forms you have, insert your data and when the PDFs are opened, these form elements remain form elements, they can be edited, unlike in usual PDF printing. So that satisfies your customer needs. The only use of CSV would be, if you find another tool merging a PDF Form with CSV, but I don't see that you could add data binding to a PDF, also not a PDF form.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Well, according to the information that Tom gave (above), the Universe product can fill in a PDF form using a CSV as a data source. The product is called PDF FieldMerge, and does just what its name suggests. An extract from their specs:

... merges variable data with pdf forms ... merges csv file with pdf forms ... supports ISO character sets for CSV data ...

Here's a link:
Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Elena,

You may use the PDF Toolkit for that (from
Take the sample form from download it in your default folder, and run in Windows command line

Code:
"c:\Program Files (x86)\PDFtk\bin\pdftk.exe" OoPdfFormExample.pdf dump_data_fields > fields.txt

(the folder where the toolkit is installed may differ, of course).

This will produce a text document with the information on the form fields. The beginning will look like this:

[pre]---
FieldType: Text
FieldName: Given Name Text Box
FieldNameAlt: First name
FieldFlags: 0
FieldValue:
FieldJustification: Left
FieldMaxLength: 40
---
FieldType: Text
FieldName: Family Name Text Box
FieldNameAlt: Last name
FieldFlags: 0
FieldValue:
FieldJustification: Left
FieldMaxLength: 40
---[/pre]

Now that you know the name of the fields in the form, you can prepare an XML document in VFP to fill the PDF document with your data. For instance:

Code:
LOCAL FirstName AS String
LOCAL LastName AS String

m.FirstName = "John"
m.LastName = "Doe"

LOCAL XMLDoc AS String

TEXT TO m.XMLDoc NOSHOW TEXTMERGE FLAGS 1
<?xml version="1.0" encoding="utf-8"?>
<xfdf xmlns="[URL unfurl="true"]http://ns.adobe.com/xfdf/">[/URL]
    <fields>
        <field name="Given Name Text Box">
            <value><<m.FirstName>></value>
        </field>
        <field name="Family Name Text Box">
            <value><<m.LastName>></value>
        </field>
    </fields>
</xfdf>
ENDTEXT

STRTOFILE(STRCONV(m.XMLDoc, 9), "fillData.xml")

At this point, you may run PDFtk from VFP to fill the form.

Code:
LOCAL WShell AS Shell.Application

m.WShell = CREATEOBJECT("Shell.Application")

LOCAL Params AS String

m.Params = TEXTMERGE('"<<SET("Directory")>>\OoPdfFormExample.pdf" fill_form ' + ;
                     '"<<SET("Directory")>>\fillData.xml" output "<<SET("Directory")>>\filledform.pdf"')

m.WShell.ShellExecute("c:\Program Files (x86)\PDFtk\bin\pdftk.exe", m.Params, "c:\Program Files (x86)\PDFtk\bin")
 
Hi

Can it be done by converting PDF to word document
From VFP you can automate word document (i.e. filling of all the required fields)
Save the word document again into PDF file

Thanks
Mukesh Khandelwal

Mukesh Khandelwal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top