dompdf->render() question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ReverendDexter
Forum Contributor
Posts: 193
Joined: Tue May 29, 2007 1:26 pm
Location: Chico, CA

dompdf->render() question

Post by ReverendDexter »

I'm trying to use dompdf on a windows box to convert a whole dir-full of .htm files to .pdfs. I've got everything installed (correctly, I believe), and I can get my script to run. However, when it goes to render, the CPU cycles kick to 100% and it just stays there until I Ctrl-C the process.

Here's the code, $filename gets declared and assigned before this

Code: Select all

$file_htm = $filename . ".htm";
$file_pdf = $filename . ".pdf";


require_once("../library/dompdf-0.5.1/dompdf_config.inc.php");
echo "\nIncluded file... preparing to create dompdf";

$dompdf = new DOMPDF();
echo "\nCreated object... preparing to load html file: $file_htm";
$dompdf->load_html_file($file_htm);
echo "\nloaded the file... preparing to render";
$dompdf->render();
echo "\nRendering the file... preparing to stream";
$dompdf->stream($file_pdf);
echo "\ndone\n";
When I run it, it will run 'til it echos "preparing to render", and that's when I'm running @ 100% CPU.

Anyone have any thoughts or ideas?

EDIT: I've changed this code, now I'm pulling all of the file contents into a string, running that through HTMLPurifier, and trying to render that instead. It's still doing the 100% CPU dance.
Post Reply