Question about html2fpdf.php

by 8 replies
13
Here is the code (created for me by a programmer)

require('html2fpdf.php');
$pdf=new HTML2FPDF();
$pdf->AddPage();
$pdf->WriteHTML($html);
$pdf->Output();

It produces a filename of doc.pdf

Do you know how to have a different file name

Thanks

Harvey
#programming #html2fpdfphp #question
  • Ok, I have found the answer

    $pdf->Output("newfilename.pdf", "D");


    Harvey
    • [1] reply
    • I'm playing around with that library myself. How's it working for you? I'm finding problems with rendering images and clickable links. Have you experienced that?
      • [1] reply
  • I solved the links problem. My fault there. I am having some better luck with images now. I think most of the responders to this thread aren't getting that you are trying to do this in PHP.
  • Oops. Wrong comment at the end of that message. I'm confusing two threads. I need to go to bed now
  • Have you had any luck forcing page breaks? I tried a CSS style that outputs:
    .break {page-break-before: always;}

    But it's not working.
  • Here's the solution to page breaks:

    <NEWPAGE>

    Add that directly to the HTML code. So, if you are using Dreamweaver, for example, switch to code view and add it right where you want the break to happen. Don;t surround it with HTML tags like < P >, etc.
    • [1] reply
    • Lisa

      This is what I use

      <page_break>

      Harvey

Next Topics on Trending Feed