samoht Posted February 21, 2011 Share Posted February 21, 2011 Hello all, I have a directory page that is populated with a foreach loop pulling info from a db table. I want to make a "Download Directory pdf" button that will print out the directory entries in a nicely formatted way. The thing is that the foreach loop uses an OO call to what every template is being used for the HTML display: foreach ( (array) $results as $row) { ... $out .= '<div class="cn-list-row' . $alternate . ' vcard ' . $template->slug . ' ' . $entry->getCategoryClass(TRUE) . '">' . "\n"; $out = apply_filters('cn_entry_before', $out, $entry); ob_start(); include($template->file); $out .= ob_get_contents(); ob_end_clean(); $out = apply_filters('cn_entry_after', $out, $entry); $out .= '</div>' . "\n"; } $out .= '<div class="clear"></div>' . "\n"; $out .= '</div>' . "\n"; $out = apply_filters('cn_list_after', $out, $results); return $out; } Any Ideas?? Link to comment https://forums.phpfreaks.com/topic/228430-create-pdf-from-database-info/ Share on other sites More sharing options...
samoht Posted February 21, 2011 Author Share Posted February 21, 2011 I meant to say "whatever template is being used" include($template->file); Link to comment https://forums.phpfreaks.com/topic/228430-create-pdf-from-database-info/#findComment-1177933 Share on other sites More sharing options...
BlueSkyIS Posted February 21, 2011 Share Posted February 21, 2011 if you are trying to convert HTML to PDF, i suggest that you skip it and just use FPDF to write to PDF. www.fpdf.org Link to comment https://forums.phpfreaks.com/topic/228430-create-pdf-from-database-info/#findComment-1177943 Share on other sites More sharing options...
samoht Posted February 21, 2011 Author Share Posted February 21, 2011 BlueSkyIS, Thanks for the link. I will use FPDF as the library. What I was not sure about was the creation of the pdf. I will read up on the tuts for FPDF - but I was hoping I wouldn't have to add to much code to the files to generate the pdf material. Link to comment https://forums.phpfreaks.com/topic/228430-create-pdf-from-database-info/#findComment-1177951 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.