seventheyejosh Posted July 27, 2009 Share Posted July 27, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/167678-solved-writing-to-a-pdf/ Share on other sites More sharing options...
Psycho Posted July 27, 2009 Share Posted July 27, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/167678-solved-writing-to-a-pdf/#findComment-884307 Share on other sites More sharing options...
seventheyejosh Posted July 27, 2009 Author Share Posted July 27, 2009 Yea I've been rolling through a few tutorials, just wondered if anyone had an "omg greatest ever" link. Thanks for the time. Quote Link to comment https://forums.phpfreaks.com/topic/167678-solved-writing-to-a-pdf/#findComment-884309 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.