• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 462
  • Last Modified:

html -> pdf without fdf?

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
sieve
Asked:
sieve
  • 4
  • 3
1 Solution
 
madwaxCommented:
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
 
sieveAuthor Commented:
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
 
madwaxCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
madwaxCommented:
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
 
sieveAuthor Commented:
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
 
madwaxCommented:
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
 
sieveAuthor Commented:

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

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now