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A;,D ~hw*eZ-:mc[e1hփF51-Ymp דkQpb 3&}DJEÒ/1DuVAc٭ #ֵ\~4@Kn8sO۾#;.Sl"]3O+Mi#:B3A` . A+>qȁ4'lUA&gV# ɍ| Oo;?7-KE6~+逦a;94k$L}HkTҺ*W]RkQR+m69,o>*D>M0 vK;N_ϥa4;pc 8{N/M߯DH(/%=ԩ4,r/C[vW%|X|Zc_ ^HT@lkou can use utf8_decode() to perform a conversion to ISO-8859-1:
$str = utf8_decode($str);
But some characters such as Euro won't be translated correctly. If the iconv extension is available, the right way to do it is the following:
$str = iconv('UTF-8', 'windows-1252', $str);
In case you need characters outside windows-1252, take a look at tutorial #7 or tFPDF.
  • 4. I try to display the Euro symbol but it doesn't work.

    The standard fonts have the Euro character at position 128. You can define a constant like this for convenience:
    define('EURO', chr(128));
  • 5. I try to display a variable in the Header method but nothing prints.

    You have to use the global keyword to access global variables, for example:
    function Header()
    {
        global $title;
    
        $this->SetFont('Arial', 'B', 15);
        $this->Cell(0, 10, $title, 1, 1, 'C');
    }
    
    $title = 'My title';
    Alternatively, you can use an object property:
    function Header()
    {
        $this->SetFont('Arial', 'B', 15);
        $this->Cell(0, 10, $this->title, 1, 1, 'C');
    }
    
    $pdf->title = 'My title';
  • 6. I have defined the Header and Footer methods in my PDF class but nothing shows.

    You have to create an object from the PDF class, not FPDF:
    $pdf = new PDF();
  • 7. I can't make line breaks work. I put \n in the string printed by MultiCell but it doesn't work.

    You have to enclose your string with double quotes, not single ones.
  • 8. I use jQuery to generate the PDF but it doesn't show.

    Don't use an AJAX request to retrieve the PDF.
  • 9. I draw a frame with very precise dimensions, but when printed I notice some differences.

    To respect dimensions, select "None" for the Page Scaling setting instead of "Shrink to Printable Area" in the print dialog box.
  • 10. I'd like to use the whole surface of the page, but when printed I always have some margins. How can I get rid of them?

    Printers have physical margins (different depending on the models); it is therefore impossible to remove them and print on the whole surface of the paper.
  • 11. How can I put a background in my PDF?

    For a picture, call Image() in the Header() method, before any other output. To set a background color, use Rect().
  • 12. How can I set a specific header or footer on the first page?

    Just test the page number:
    function Header()
    {
        if($this->PageNo()==1)
        {
            //First page
            ...
        }
        else
        {
            //Other pages
            ...
        }
    }
  • 13. I'd like to use extensions provided by different scripts. How can I combine them?

    Use an inheritance chain. If you have two classes, say A in a.php:
    require('fpdf.php');
    
    class A extends FPDF
    {
    ...
    }
    and B in b.php:
    require('fpdf.php');
    
    class B extends FPDF
    {
    ...
    }
    then make B extend A:
    require('a.php');
    
    class B extends A
    {
    ...
    }
    and make your own class extend B:
    require('b.php');
    
    class PDF extends B
    {
    ...
    }
    
    $pdf = new PDF();
  • 14. How can I open the PDF in a new tab?

    Just do the same as you would for an HTML page or anything else: add a target="_blank" to your link or form.
  • 15. How can I send the PDF by email?

    As for any other file, but an easy way is to use PHPMailer and its in-memory attachment:
    $mail = new PHPMailer();
    ...
    $doc = $pdf->Output('S');
    $mail->AddStringAttachment($doc, 'doc.pdf', 'base64', 'application/pdf');
    $mail->Send();
  • 16. What's the limit of the file sizes I can generate with FPDF?

    There is no particular limit. There are some constraints, however:

    - There is usually a maximum memory size allocated to PHP scripts. For very big documents, especially with images, the limit may be reached (the file being built in memory). The parameter is configured in the php.ini file.

    - The maximum execution time allocated to scripts defaults to 30 seconds. This limit can of course be easily reached. It is configured in php.ini and may be altered dynamically with set_time_limit().

    You can work around the memory limit with this script.
  • 17. Can I modify a PDF with FPDF?

    It's possible to import pages from an existing PDF document thanks to the FPDI extension. Then you can add some content to them.
  • 18. I'd like to make a search engine in PHP and index PDF files. Can I do it with FPDF?

    No. But a GPL C utility does exist, pdftotext, which is able to extract the textual content from a PDF. It's provided with the Xpdf package.
  • 19. Can I convert an HTML page to PDF with FPDF?

    Not real-world pages. But a GPL C utility does exist, HTMLDOC, which allows to do it and gives good results.
  • 20. Can I concatenate PDF files with FPDF?

    Not directly, but it's possible to use FPDI to perform that task. Some free command-line tools also exist: pdftk and mbtPdfAsm.