9

I need to collect data from a visitor in an HTML form and then have them print a document with the appropriate fields pre-populated. They'll need to have a couple of signatures on the document, so it has to be printed.

The paper form already exists, so one idea was to scan it in, with nothing filled out, as an image. I would then have the HTML form data print out using CSS for positioning and using the blank scanned form as a background image.

A better option, I would think, would be to automatically generate the PDF with this data, but I'm not sure how to accomplish either.

Suggestions and ideas would be greatly appreciated! =)

4 Answers 4

5

I would have to respectfully disagree with Osvaldo. Using CSS to align on a printed document would take ages to do efficiently in the aspect of cross-browser integration. Plus, if Microsoft comes out with a new browser, you're going to have to constantly update for the new use in browsers.

If you know any PHP (Which, if you know JavaScript and HTML, basic PHP is very simple), here's a good library you can use, FDPF:

Thankfully, PHP doesn't deprecate a whole lot of methods and the total code is less than 10 lines if you have to go in and change things around.

Sign up to request clarification or add additional context in comments.

4 Comments

I went to: html2fpdf.sourceforge.net and this is what I read on that page: "Warning: This page requires Adobe Acrobat Reader plugin installed. Go THERE if you don't have one." The THERE link takes me to Adobe, but I do have Acrobat Reader installed. If you use PDF embed on a page, be sure it doesn't provide better cross-browser integration than an html+css page.
I'm not sure I understand your comment fully. It sounds like the THERE link is only for people who don't have Adobe Acrobat on their computer. And of course, if you're working with PDF you would definitely need to have Acrobat installed.
I do have Acrobat Reader installed and I do saw the warning message above, on that page, instead of the PDF some other people are seeing.
I side with @Christopher on this one. I know this post is old, but there's a great script here that utilizes the FPDF library.
2

You can control printed documents acceptably well with CSS, so I would suggest you to try that option first. Because it's easier.

2 Comments

Good feedback, thanks. Do you have suggestions on how I can accomplish this? A CSS framework or something???
Use something like normalize.css to make sure it works consistently across browsers and test.
0

This is actually a great php library for converting HTML to PDF documents http://code.google.com/p/dompdf/ there are many demo's available on the site

Comments

0

XSL-FO is what I would recommend. XSL-FO (along with XSLT and XPath) is a sub-standard of XSL that was designed to be an abstract representation of a formatted document (that contains, text, graphic elements, fonts, styles, etc).

XSL-FO documents are valid xml documents, and there exist tools and apis that allow you to convert an XSL-FO documet to MS Word, PDF, RTF, etc. Depending on the technology you use, a quick google search will tell you what is available.

Here are a few links to help you get started with XSL-FO:

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.