Page 1 of 1
MySQL to PHP to PDF
Posted: Fri Apr 28, 2006 2:02 am
by phpcloud
I am trying to fill an existing PDF form with data from MySQL. I have found a lot of resources on generating a PDF using PHP but nothing on populating an existing PDF form from MySQL using PHP.
Any help would be greatly appreciated. Thanks in advanced for your time and help!
Posted: Fri Apr 28, 2006 2:12 am
by feyd
If you can fill the form through PHP, then it's pretty simple to use MySQL result data to fill the same information. It's all basic variables in the end.

Posted: Fri Apr 28, 2006 2:16 am
by phpcloud
I don't know how to fill it with PHP. I don't have much PDF experience and am not sure how to interact PHP with PDF. Any help you can provide would be great!
Thanks!
Posted: Fri Apr 28, 2006 9:21 am
by danielconaghan1
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
The problem is that its quite a competetive field at the moment.
I use a php script that creates a pdf object. The object is written by the php then converted to a pdf.
the way html is written by php.
Code: Select all
$field ="SELECT * FROM field_data WHERE page_id=" . $page_no;
$field_results = $db->query($field);
while($field_row = mysql_fetch_assoc($field_results)) {
$data=$field_row['text'];
$FormatCode = array("~b->", "<-b~", "~i->", "<-i~","~u->", "<-u~");
$RemovedCode = array("<b>", "</b>", "<i>", "</i>","<c:uline>", "</c:uline>");
$data = str_replace($FormatCode, $RemovedCode, $data);
$size=($field_row['size']*3);
$x1 =($field_row['x1']*$co_change);
$y1 =($docheight - ($field_row['y1']*$co_change));
$ydif = $pdf->getFontHeight($size);
$y1 = $y1 - $ydif;
$width =($field_row['x2']*$co_change);
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]