Jump to content

[SOLVED] Writing to a pdf


seventheyejosh

Recommended Posts

Hello all. I need to write to a pdf!

 

Say I have a mysql database:

 

ID | Name

 

and a directory of images, entitled

 

pic.id.jpg

 

where id is tied to the id field of the db. so in actuality it'd be

 

pic1.jpg , pic45.jpg , etc

 

What would be the best way to write to a pdf with a header string, and then the corresponding image in the middle of the page.

 


$res=mysql_query("SELECT * FROM `table`");
while($row=mysql_fetch_array($res)){

$title=$row['title'];
$image="picture".$row['id']."jpg";

fopen("filenumber".$row['id'].pdf", w);

//write to it somehow

fclose();

}//end while

 

yaya, its bad fopen etc, just trying to get the idea across. I need to do this for ~2700 images :'(.

 

So the question is: how do i write a pdf with db info so it looks like this:

 

 

<--pdf-->

 

TITLE

 

IMAGE

 

DATATABLE

 

<--pdf-->

 

Thanks all!

Link to comment
https://forums.phpfreaks.com/topic/167678-solved-writing-to-a-pdf/
Share on other sites

A forum isn't exactly an appropriate medium for explaining all of this. That is why there are tutorials. Have you looked at any tutorials for this? If you have problems understanding something in those tutorials then post a question for clarification.

 

This should get you started: http://www.sitepoint.com/article/generate-pdfs-php/

 

Note: I have not read/followed that tutorial so I cannot comment on its quality, but the general descriptions sounds like it is just what you need.

 

However, I'm not sure if you can edit an already created PDF document with the PDF library.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.