Jump to content

Print Preview with PHP that maps answers to PDF.


coupe-r

Recommended Posts

Hi Everyone,

 

I will have a web application that users fill out and submit.  I also have the same form in PDF format.  I would like users to be able to click a print preview button, then open up FoxIt or Adobe and display the PDF, with their answers mapped to the correct location.

 

I have no code, just looking for a direction and didn't know what to search for.

 

Thanks.

Link to comment
Share on other sites

Thanks for the reply..

 

I looked at the site, but it looks like thats for generating a PDF with PHP.  I already have a PDF of the application.  For instance:

 

On my PDF application, there are spaces for first name, last name, etc.  The same fields are on the online form.  Basically, I want my database to populate the PDF file, based on the users response.  So if they filled first name and last name on the online form and press print preview, both elements would be printed on the PDF.

 

Is that what this site allows you to do?  They have 30-40 different links and none seem like they would.

Link to comment
Share on other sites

From pdftk man pages:

 

fill_form < FDF data filename | XFDF data filename | - | PROMPT >

Fills the single input PDF’s form fields with the data from an FDF file, XFDF file or stdin. Enter the data filename after fill_form, or use - to pass the data via stdin, like so:

 

pdftk form.pdf fill_form data.fdf output form.filled.pdf

 

After filling a form,the form fields remain interactive unless you also use the flatten output option. flatten merges the form fields with the PDF pages. You can use flatten alone, too, but only on a single PDF:

 

pdftk form.pdf fill_form data.fdf output out.pdf flatten

 

or:

 

pdftk form.filled.pdf output out.pdf flatten

 

If the input FDF file includes Rich Text formatted data in addition to plain text, then the RichText data is packed into the form fields as well as the plain text. Pdftk also sets a flag that cues Acrobat/Reader to generate new field appearances based on the Rich Text data. That way, when the user opens the PDF, the viewer will create the Rich Text fields on the spot. If the user’s PDF viewer does not support Rich Text, then the user will see the plain text data instead. If you flatten this form before Acrobat has a chance to create (and save) new field appearances, then the plain text field data is what you’ll see in the flattened PDF.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.