[Cialug] pdf thing (again)

Barry Von Ahsen barry at vonahsen.com
Fri Nov 3 08:49:08 CST 2006


we use ezpdf (http://www.ros.co.nz/pdf/) here at work to generate 
contracts and w9 forms from database data.  the initial setup of a form 
can be a bit difficult (you can pixel position everything, if you wanted 
to), but the price is perfect :)

-barry

(some sample code)
include_once('class.ezpdf.php');
$pdf = new Cezpdf('letter','portrait');
$pdf->ezSetMargins(43,30,30,50);
$bf_size = 12;

$mainFont =  '/fonts/Helvetica.afm';
$pdf->selectFont($mainFont);
	
// SET DOCUMENT INFO
$pdf->addInfo('Title', 'My PDF');
$pdf->addInfo('Subject', 'Test');
$pdf->addInfo('Author', 'Me');
$pdf->addInfo('Producer', 'Myself');
$pdf->addInfo('CreationDate', date("m/d/Y h:i:s A") );

$txt = "This is a paragraph\n";
$pdf->ezText($txt,$bf_size,array('justification'=>'left'));
	
$txt = "Your name is: " . $database_variable . "\n";
$pdf->ezText($txt,$bf_size,array('justification'=>'left'));

if($stream) {
	$pdf->ezStream();
} else {
	$pdfcode = $pdf->ezOutput();
	$fh = fopen("/path/to/pdf",rb);
	fwrite($fh, $pdfcode);
}


Dave J. Hala Jr. wrote:
> Basically what I did when trying out pdf-tools' form filling tool was to
> load the pdf form into acrobat professional. Then I defined the data
> fields and saved the form.
> 
> To fill the form, I read the data from the database, and passed the
> information to the form filling tool on the command line. Their tool
> took the original pdf and the data and created a new, filled out pdf. It
> was slick and it worked well. Smoking fast, with almost no overhead.
> 
> I'm not against forking out $2k for pdf-tools's software. However, I
> have all dual cpu machines and possibly a quad coming in the future.
> That will raise my licensing fees considerably. Don't get me wrong,
> pdf-tools is well worth the money and they have excellant support.
> However, if I can find a lower cost alternative, I could be more
> competitive.
> 
> :) Dave
> 
> 
> 
> 
> 
> On Fri, 2006-11-03 at 07:42, carl-olsen at mchsi.com wrote:
>> From what I see, it looks like it would be possible to build the FDF
>> file using PHP and data from a database.  I'm not too familiar with
>> running command line instructions using PHP, but I'm sure that its not
>> difficult.  I'm wondering if I can create the form using Acrobat and
>> then use this tool to fill in the form fields, or whether the PDF has
>> to be created using this tool.  I know how to create a form with fill
>> in fields using Acrobat, but I'd be lost if I had to create one from a
>> command line.
>>
>>  
>>
>> I know how to capture form fields from a PDF and put the data into a
>> database, but I never could figure out how to populate the fields from
>> the database later when I wanted to print out a copy of a form that
>> someone filled out using a web browser.  The options I found at that
>> time were very expensive.  I looked at the IRS website and found the
>> tool they were using was about half the price of the Adobe tools, but
>> it was still several thousand dollars.
>>
>>  
>>
>> Carl Olsen
>>
>> Web Developer
>>
>> Drake University
>>
>>
>>         -------------- Original message from "Dave J. Hala Jr."
>>         <dave at 58ghz.net>: -------------- 
>>         
>>         
>>         > I've been experimenting with a trial version of PDF Tools
>>         form filling 
>>         > tool. (www.pdf-tools.com) It takes an existing pdf, and
>>         allows you to 
>>         > insert data into the form fields in the pdf. 
>>         > 
>>         > It works awesome. However, its priced by CPU. This makes it
>>         a little 
>>         > pricey on a dual cpu server or a dual core server. I'm
>>         looking for a 
>>         > lower cost alternative. 
>>         > 
>>         > I found something called pdftk or PDF Toolkit 
>>         >
>>         http://applications.linux.com/article.pl?sid=06/04/17/1943230&tid=47 
>>         > 
>>         > It seems to be the solution I'm looking for. Has anyone had
>>         any 
>>         > experience with it before? 



More information about the Cialug mailing list