Solved

html -> pdf without fdf?

Posted on 2004-04-19
8
452 Views
Last Modified: 2012-05-04
Hello,
  Is there any way to take data from an HTML (using PHP) form submitted by a user, send the data to a MySQL database, AND populate a PDF form (produced with Acrobat 6) WITHOUT using the FDF toolkit from Adobe or other pdf libs that have to be installed on the server?
  I'm developing a web application under a huge time-crunch and my hosting provider doesn't have the FDF toolkit installed, and I don't think they'll do it for me.  I can't take the time to find another provider right now, and I've seen some ways of populating PDFs with form data that don't require installing/compiling any dlls or modules, etc.
  Anyone have any experience with this?  I already have the form, and can handle the SQL coding, but I need a way to populate the PDF apart from installing anything on the server, if possible.

Thanks!
0
Comment
Question by:sieve
  • 4
  • 3
8 Comments
 
LVL 7

Expert Comment

by:madwax
ID: 10859649
I have used FPDF (PHP-based) with great success and it doesn't need anything to be installed on the server:

http://www.fpdf.org/

You can ask me if you don't get it but I would recommend their examples since they are very good. The only drawback is that ther functions are'nt as good as the other pdf-genrators... but it's free and you dont need to install anything just implement their class in your own (by e.g. an extension)
0
 

Author Comment

by:sieve
ID: 10859758
Thanks for the link.

Am I understanding it correctly, basically, rather than actually populating fields, I specify coords for where I want the text to appear?  Not a bad way to do it, but is there a way to input into the actual fields that I've created in the PDF form?  Along with that, I don't see a command for starting with the form I've already created -- how would I make that my starting point.

Sorry for being simplistic -- as I mentioned, I'm under a huge time constraint and I don't want to spend my time re-inventing the wheel!
0
 
LVL 7

Expert Comment

by:madwax
ID: 10859989
I don't really understand what you mean with a PDF form.

What you do with the fpdf is that you take your string (or other type) sent from your form and put it into a fpdf-cell which you specify on the pdf-page-to-be. The fpdf generates the code for the pdf and you can open it in your browser.

//jan
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 7

Expert Comment

by:madwax
ID: 10860012
If I understood your question right, the simplest solution for you should be:

<?php
define('FPDF_FONTPATH','font/');
require('fpdf.php');

$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>

where you change the:
$pdf->Cell(40,10,'Hello World!');
to
$pdf->Cell(40,10,$_POST['nameOfTheTextFieldInYourAlreadyCreatedForm']);

where you send your form-data with post and the name of the field in the form is "nameOfTheTextFieldInYourAlreadyCreatedForm"...

Hope this helps,
//jan
0
 

Author Comment

by:sieve
ID: 10860105
Thanks, I'm starting to get it.

What I mean by PDF form, is I've created a PDF in Acrobat Professional and added fields to the form, (called PDFForm for this example.)  Basically, I need to collect user information via an html form (called HTMLForm for this example), and populate the fields of PDFForm with that information, plus some added info based on other criteria.  I can get the data from the user, and derive the "added info", but I'm not sure if fpdf can put the two together.

I just found some info that talks about php having pdf capabilities via php_pdf, I know that's a server-side module, but I think most php capable servers already have it installed, and I'm checking to see if mine does.

Any experience with php_pdf?  Will this work?

Here's the link:http://www.phpfreaks.com/phpmanual/page/ref.pdf.html
0
 
LVL 7

Accepted Solution

by:
madwax earned 500 total points
ID: 10860168
The problem with the pdf on the supplied link is the following row under requirements:

"...PDFlib is available for download at http://www.pdflib.com/pdflib/index.html, but requires that you purchase a license for commercial use. The JPEG and TIFF libraries are required to compile this extension...."

Since I guess you won't be using your application for personal use it is an additional fee of:
PDFlib 5 US-$ 450      
PDFlib+PDI 5 US-$ 900      
PDFlib Personalization Server (PPS) 5 US-$ 1450

About your PDFForm, I don't think that FPDF will solve your problem with populating the form created in Acrobat Proffessional. It can only create pdf-files on the fly. And as I said it works pretty good, it's free and it doesn't require anything from the server.

//jan

0
 

Author Comment

by:sieve
ID: 11940994

Sorry for letting this sit so long, thanks madwax for your help.  Not the exact answer, but it helped rule some things out.

Ultimately, I ended up using Acrobat Pro to add the fields to the PDF form & tracking down the syntax of the FDF file.  I dynamically adding the user's data and named fields from the PDF to the FDF file and using a PHP script to open the FDF in the user's browser.  Embedded in the FDF is the name of the PDF to open, so Adobe recognizes the FDF and automatically populates the form.  All said, the PDF portion of the script was only 8-10 lines!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Uploading files to the web server has become common part of almost any kind of web application. People use different technologies to solve this, but regardless of the technology used, it is always useful to have some kind of progress indicator shown…
Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now