Forum Moderators: coopster

Message Too Old, No Replies

dompdf

has anyone used this before?

         

tonynoriega

3:48 pm on Sep 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am trying to incorporate this little app into my site to create some pages into PDF, but there isnt much support and the forum is not very helpful...

just checking to see if anyone has used this, if so could they lend some insight.

thanks all.

coopster

10:48 pm on Sep 16, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Used it? Yes. Like it? Undecided. It is not very flexible when it comes to formatting documents. If you have a look at the source, it uses other PDF libraries on the backend and perhaps you will get better support using those forums.

tonynoriega

3:50 pm on Sep 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Coopster, maybe you can help me diagnose an error i have with this.

I have come to the point of getting the prompt for the download of the PDF document via "open file" or "save to disk" dialog box...

When i do it gives an error when i try to open it of:

"There was an error opening this document. The file was damaged and could not be repaired"

I check my error log and found this:

[Mon Sep 17 11:39:29 2007] [error] PHP Notice: Undefined variable: html in /home/newhecom/public_html/addons/leadstable/addon.inc.php on line 2605

I dont understand what isnt defined?

Here is my function:

function leadstabledompdf_display_addon() {
require_once("../addons/dompdf-0.5.1/dompdf_config.inc.php");
//line 2605 $html .='<html><body><table border="1"><tr><td><div style="font-family:Times-Roman;">Test</div></td></tr></table></body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("builderreport.pdf");
}

coopster

5:16 pm on Sep 17, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It is telling you in the error. See it? html is not defined.

[Mon Sep 17 11:39:29 2007] [error] PHP Notice: Undefined variable: html in /home/newhecom/public_html/addons/leadstable/addon.inc.php on line 2605

Line 2605 is attempting to append string data to the $html variable -- that is what the .= is doing, attempting to concatenate more html to the variable that the function assumes already exists. I'm guessing that the included data is not initializing the $html variable.

tonynoriega

5:58 pm on Sep 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok, and i have to rephrase...

i meant to say "i dont understand why it isnt defined"

thanks ill look...

whoisgregg

6:52 pm on Sep 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Technically before you can:

$html .= ...;

You need to:

$html = ...;

So that error isn't really related to dompdf at all, it's just because when you try to concatenate (.=) to a variable that hasn't been used yet, php complains. :)