Question about html2fpdf.php

8 replies
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
#html2fpdfphp #question
  • Profile picture of the author Harvey Segal
    Ok, I have found the answer

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


    Harvey
    {{ DiscussionBoard.errors[1685946].message }}
    • Profile picture of the author lisag
      Originally Posted by Harvey.Segal View Post

      Ok, I have found the answer

      ("newfilename.pdf", "D");


      Harvey
      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?
      Signature

      -- Lisa G

      {{ DiscussionBoard.errors[1686564].message }}
      • Profile picture of the author Harvey Segal
        Hi Lisa

        Images are difficult/impossible to position.

        Clickable links are not a problem.

        Also it's important to have the correct HTML
        - for example you must always include
        closing tags

        Harvey


        .
        {{ DiscussionBoard.errors[1686718].message }}
  • Profile picture of the author lisag
    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.
    Signature

    -- Lisa G

    {{ DiscussionBoard.errors[1686816].message }}
  • Profile picture of the author lisag
    Oops. Wrong comment at the end of that message. I'm confusing two threads. I need to go to bed now
    Signature

    -- Lisa G

    {{ DiscussionBoard.errors[1686817].message }}
  • Profile picture of the author lisag
    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.
    Signature

    -- Lisa G

    {{ DiscussionBoard.errors[1686874].message }}
  • Profile picture of the author lisag
    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.
    Signature

    -- Lisa G

    {{ DiscussionBoard.errors[1686889].message }}

Trending Topics