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:
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 ?
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 ?