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

How to write to a PDF 2

Status
Not open for further replies.

dylim

Programmer
Dec 12, 2001
106
PH
Hi Experts,

I would like to automate the tedious process of typing/encoding to a PDF (using free apps like FoxitReader or Adobe).

The PDF is a government issued PDFs for filing Social Security, Withholding Tax returns, data of which are obtained from a payroll system I developed for them. Imagine the task of encoding these forms if the company has say 100 employees.

Thank you in advance for any leads and/or tips provided.

Kindly find attached the PDF that was downloaded from our government website.

Long Live the Fox!


 
 https://files.engineering.com/getfile.aspx?folder=6ab367bf-7125-4fc4-af2a-faf86df37edd&file=2316_Sep_2021_ENCS_Final_corrected.pdf
There are several ways of doing this:

1. Use FoxyPreviewer. It's free; it works; and it's got lots of other useful features. See
2. Install a PDF printer driver, of which there are many available, some of them free. You then print the report in the normal way, but send the output to the driver instead of a physical printer. (But not all drivers allow you to specify the destination file and directory programmatically - something to check.)

No doubt others here will have other suggestions.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,

I am afraid I may have mislead with my words.

There is already an existing PDF which we need to encode or fill out the blanks with data such as Last Name, First Name, Tax Withheld etc. I have attached the actual PDF that we need to write or fill out to.

Thanks once again.
 
The only thing I know can be automated from VFP is the Amyuni PDF Creator (in its ActiveX version).

I have never used it myself, so I can't tell you further details.

Chriss
 
Hi,

This PDF don't contains form data or XFA Forms definition (attachment contains your pdf converted to doc).

But it's possible use COM or .NET component for reading PDF file, add changes (text on exactly position) to page and write new file.

MartinaJ

mJindrova
 
 https://files.engineering.com/getfile.aspx?folder=a604bf6f-ea2c-4745-a15e-0a725e63debb&file=output.zip
Here a couple of threads where we have previously discussed this topic:

thread184-1803160

thread184-939138

Chris mentioned Amyuni. That would probably be a good choice. It's not free, but it is not all that expensive, and it is available for outright purchase rather than on a subscription. See
There is also a product called PDF_FieldMerge from Universe Software which might be a possibility (I've no personal experience of it). See
So, lots of possibilities.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
mJindrova

In my googling, I got to see some PDFs which are "fillable" - one can create text files with the FDF extension to "merge" FDF data into the PDF.

Sadly, this government form is not of the fillable type.

 
Mike,

Yeah I saw some of those too.

I will check out the others I did not see yet.

Thanks!
 
Chris,

I will check this out.

Thanks!
 
dylim said:
In my googling, I got to see some PDFs which are "fillable" - one can create text files with the FDF extension to "merge" FDF data into the PDF.

Sadly, this government form is not of the fillable typ


Yes, this a PDF file not is fillable.

But you can use dontnet bridge and iTextSharp ( for reading pdf file, modifying and saving to new file.

PDF file in attachment was created by XFRX (converts from PDF to XFF, add new texts to page 1 and exporting to new PDF file)



mJindrova
 
A coincidence: A few minutes after I submitted my above post, I received an email from an old client with a similar requirement. They currently send out a paper form to their members, who fill it in (on paper) and mail it back. Obviously, it would be nice to be able to do the whole thing electronically.

So I now have to work out the best way to create a fillable PDF form in VFP, in such a way that any of the recipients can fill it in on the screen. The second part will be difficult, given that we don't know what software they use to read PDFs and we can't ask them to purchase any specific software. In fact, we don't even know if they all use Windows computers - or any other platform.

I'll be investigating this further, and will report back if I find anything useful.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Dylim,

In reality, since a manuscript signature seems to be required, you don't need to fill out the PDF. What you do need is to print the payment information over a) a previously printed form, or b) an image of the form.

Isn't that so?
 
Mike,

I don't know about your exact requirements and how this has to integrate into an existing structure, but the one thing that would be simple to use on all platforms is HTML forms. Given you start based on existing document based forms, I'm not sure it's simpler to convert to HTML or PDF, both also need something like collecting the answers as data.

I think you have as little background in PDF forms as I have, I personally would solve your requirement with a webpage on an already given domain (I would assume exists) or using something universally available like google forms, which provides the means of storing the form data in google sheets, so you can easily collect and evaluate the results without extracting the answers from every single PDF coming back.

Chriss
 
Chris, thanks for those comments. I've been looking a bit closer at using PDF forms, and I've decided it just won't be feasible. I can see how to create the forms, but I can't see any way in which we can expect the users to correctly fill in the forms without a lot of hand-holding and hassle.

I will consider doing it in HTML instead. I feel more confident in that area. My only slight worry is that it will involve some server-side programming, which isn't my strongest point, but no doubt it will be do-able.

I also considered Google Forms. I used that on another project, and it worked well. But this particular form might be too complicated for it: it's essentially a 25 x 2 grid of checkboxes. I don't know how that would look in Google Forms, or how the data will be stored. But I'll keep it in mind.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike

I'm sure most pdf readers, even M$ edge's, allow you to fill in a form based PDF, are you thinking you want some info from
a database filled in before sending the form?


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.

There is no place like G28 X0 Y0 Z0
 
There is another alternative.
Capture the PDF as an image, and put that into a VFP report form.
Use VFP to populate the form using fields the way you would so any report, with the "image" as a background. You don't have to recreate the PDF this way.
Then, you can simply print to PDF as Mike mentioned before. No need to muck tediously with a file, just make it LOOK like the file, and noone will know the difference, since it doesn't have editable fields. (Or even if it did you can still do the same thing).

EDIT: One thing, make sure you capture a high resolution image. The best way is open the PDF in a 4k screen, maximize it, screen capture (or clip it), save the image as a PNG preferably (though this will be a little bigger, but the clarity will result in the expected receiving party not realizing it's not the "original" PDF. If the resolution still isn't high enough, you can use something like Photoshop to scale it afterward, and then use that image in your report form. One other thing to note is, this works with PROTECTED PDF's as well, so no need to figure out passwords or have access, just take picture of it, and build your results into the report, output to PDF, and all good, dead simple solution.


Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCAP, CDCP, CDCS, CDCE, CTDC, CTIA, ATS, ATD

"I try to be nice, but sometimes my mouth doesn't cooperate.
 
A minor (but critical) note about combining data into pdf forms:

I downloaded about 25 pdf divorce forms from state government web site into which my program inserted the data provided by the plaintiff. I created the reports using images of the pdfs and inserting fields at the appropriate places, as previously mentioned.

My program inserted the data in those fields as expected. The only problem was the data sometimes did not align perfectly in the field as expected which made the form look imperfect to the chagrin of the customer. I had to shift the field somewhat by experimentation which looked wierd but printed out fine by Foxypreviewer.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top