Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Fpdf

  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    86
    Thanks
    5
    Thanked 1 Time in 1 Post

    Fpdf

    I am creating a PDF file from HTML, but it is not retaining the formatting of things like the font etc.

    Any ideas why:
    $pdf=new PDF();

    $pdf->SetMargins($left_margin, $top_margin);
    $pdf->pgwidth = 210-($left_margin+$right_margin);
    $pdf->SetAutoPageBreak (true, $bottom_margin);
    $pdf->AddPage();
    $pdf->WriteHTML($buffer);
    $pdf->Output(getcwd()."/".$name);

    This is the only problem I am having. Everything else is working well.

    Thanks for your help guys.

    Cheers

    The Moose

  • #2
    New Coder
    Join Date
    Aug 2009
    Posts
    26
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by the moose View Post
    I am creating a PDF file from HTML, but it is not retaining the formatting of things like the font etc.

    Any ideas why:
    $pdf=new PDF();

    $pdf->SetMargins($left_margin, $top_margin);
    $pdf->pgwidth = 210-($left_margin+$right_margin);
    $pdf->SetAutoPageBreak (true, $bottom_margin);
    $pdf->AddPage();
    $pdf->WriteHTML($buffer);
    $pdf->Output(getcwd()."/".$name);

    This is the only problem I am having. Everything else is working well.

    Thanks for your help guys.

    Cheers

    The Moose
    if you need to save to file you have to use F option like

    PHP Code:
    $pdf->Output(getcwd()."/".$name,'F'); 
    by the way make sure you file name ends with .pdf extension.

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    86
    Thanks
    5
    Thanked 1 Time in 1 Post
    Thanks for that!

    Basically, the only issue I am having is the HTML formatting is NOT being carried across to the final PDF (

    Any ideas why??

    Cheers

    The Moose


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •