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!

VFP, Acrobat & Forms 2

Status
Not open for further replies.

brigmar

Programmer
Mar 21, 2006
414
US
I am printing W4's for my company on behalf our clients.
I have downloaded the W4 PDF from the IRS website.
I truncated it to a single page, and renamed some of the form fields to be easier to read.

I then found this thread:

It details how to automate Acrobat thru VFP and fill forms, and I played until I came up with the following proof of concept:

Code:
CLOSE DATABASES ALL

filename = "C:\scratch\w4template.pdf"

acroexchapp   = CREATEOBJECT("AcroExch.App")
acroexchavdoc = CREATEOBJECT("AcroExch.AVDoc")
acroexchavdoc.OPEN(filename, "")
acroform      = CREATEOBJECT("AFormAut.App")
acrofields    = acroform.FIELDS

USE c:\scratch\mydatafile
SCAN 
  FOR EACH fld IN acrofields
    fld.value = ICASE( fld.name = "claim_nm", claim_nm, ;
                       fld.name = "address1_2_3", address123;
                       fld.name = "citystatezip", citystatezip;
                       fld.name = "billcode", billcode,;
                       "" )
  NEXT
  AcroExchAVDoc.PrintPages(0, 1, 2, .t., .f.)
ENDSCAN

AcroExchAVDoc.Close(.T.)
AcroExchApp.Exit

As you can see, this is equivalent to a mail-merge, but it takes forever for large tables, as each record is queued as a separate print job.

What I would like to do is instead of printing, is to take a snapshot of the filled out form, and append that page to another PDF, leaving me with a single PDF, one W4 per page.

So how do I go about "flattening", and then cutting/pasting ?
 
Thanks Mike, I never expected a reply so quickly.

The posted link allows me to combine multiple PDFs into one, which is part of my solution.

However it doesn't address "flattening" the form. That is, saving the PDF so that the form fields are no longer data fields. When copying two files with the same forms on them, the data from the first file overwrites the data on the others as they share the same field name.

I've been having atrocious luck searching for information on the object models to use for Acrobat.
 
That's what I am looking for in the Acrobat UI, but unable to find. At least then I would have an idea of the functions to call.
 
Brigmar,
I have worked with activex from adobe version 5. what version are you working with and are you using the sdk from adobe?
Can you share your solution?
wjwjr
 
White605,
I don't have access at the moment, but I'm pretty sure I'm using acrobat v6, and no, I don't have the SDK.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top