Jump to content

Create pdf from database info


samoht

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.