Questions tagged [fpdf]

A PHP class which allows developers to generate PDF files with pure PHP instead of the PDFlib library.

Home page of FPDF

FPDF is a PHP class which allows developers to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.

FPDF has other advantages: high level functions. Here is a list of its main features:

  • Choice of measure unit, page format and margins
  • Page header and footer management
  • Automatic page break
  • Automatic line break and text justification
  • Image support (JPEG, PNG and GIF)
  • Colors
  • Links
  • TrueType, Type1 and encoding support
  • Page compression

FPDF requires no extension (except zlib to activate compression and GD for GIF support). It works with PHP 4 and PHP 5

2301 questions
96
votes
20 answers

FPDF utf-8 encoding (HOW-TO)

Does anybody know how to set the encoding in FPDF package to UTF-8? Or at least to ISO-8859-7 (Greek) that supports Greek characters? Basically I want to create a PDF file containing Greek characters. Any suggestions would help. George
yorgos
  • 1,730
  • 5
  • 20
  • 28
42
votes
1 answer

Make text wrap in a cell with FPDF?

Right now when I use a cell with text, it all stays on one line. I know I could use the write function, but I want to be able to specify the height and width. This is what I have now, but as I said the text does not wrap to stay in the…
Carson
  • 4,541
  • 9
  • 39
  • 45
41
votes
14 answers

Inserting line breaks into PDF

I'm generating some PDF file on the fly using PHP. My problem is I need to insert line breaks in some part of the text that will be inserted in the PDF file. Something like: $pdf->InsertText('Line one\n\nLine two'); So it prints: Line one Line…
Carlo
38
votes
11 answers

Special Characters in FPDF with PHP

I have a web form that users can fill out and that content fills up a PDF with FPDF and PHP. When a user enters a word with an apostrophe, a slash appears before it on the PDF. Similarly, special characters like trademark symbols are encoded…
Carson
  • 4,541
  • 9
  • 39
  • 45
36
votes
15 answers

FPDF error: Some data has already been output, can't send PDF

I am using the fpdf library for my project, and I'm using this to extend one of the drupal module. These lines $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial','B',16); $pdf->Cell(40,10,'Hello World!'); $pdf->Output(); give me an error:…
Wondering Coder
  • 1,652
  • 9
  • 31
  • 51
36
votes
9 answers

FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI

I am running the following code and giving me this error : FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI. I used another pdf named test.pdf and that works…
user851939
33
votes
8 answers

Download in browser with ajax request

I'm working with AngularJS and I'm trying to generate a PDF in php. This is what I have in my controller.js: $scope.downloadPDF = function(){ $http.post('/download-pdf', { fid: $routeParams.fid }) .success(function(data, status, headers,…
nielsv
  • 6,540
  • 35
  • 111
  • 215
33
votes
2 answers

How to set a bottom margin in FPDF

I've taken a dive into FPDF lately and something that i don't seem to understand is - why is there no way to set a bottom margin? There are functions for setting margins from the top, left and right, but not from the bottom. I assume now that i…
SquareCat
  • 5,699
  • 9
  • 41
  • 75
32
votes
1 answer

How to set encoding in PHP FPDI library

How to set UTF-8 encoding in php library named FPDI? Here's library: https://www.setasign.com/products/fpdi/manual/ The code: $pdf = new Fpdi(); $pdf->AddPage(); $pdf->setSourceFile('PdfDocument.pdf'); $tplIdx = $pdf->importPage(1); …
Adam Kozlowski
  • 5,606
  • 2
  • 32
  • 51
26
votes
2 answers

Setting paper size in FPDF

i want to seting paper size in fpdf to a half of letter size, it's approximately 8.5x5.5 inc. How can i do that? My fpdf function in php language is $pdf = new FPDF('P','mm','?????'); is there any solution? Thank's before for your help..
irwan
  • 313
  • 1
  • 4
  • 11
25
votes
9 answers

Saving file into a prespecified directory using FPDF

I want to save the PDF file into a user specified directory. I am using FPDF. And the code is as below:
Sharmin
  • 251
  • 1
  • 3
  • 3
24
votes
6 answers

Inserting an image with PHP and FPDF

I'm trying to insert an image but do not want to specify the x and y coordinates. Is that possible? $pdf->Image($image1, 5, 70, 33.78); I want to be able to specify the size (33.78) but not the x and y so that it moves based on the…
Carson
  • 4,541
  • 9
  • 39
  • 45
20
votes
4 answers

FPDF print MultiCell() adjacently

I've googled around and found this question very common but I can't seem to find a proper and direct answer. I'm using FPDF and I want to generate tables using MultiCell() since I need the line break property of it. Tried Cell() but it can't read…
xjshiya
  • 915
  • 7
  • 16
  • 44
18
votes
5 answers

Email PDF Attachment with PHP Using FPDF

I want to email a PDF as an attachment that was created using FPDF. My code looks like this, but the attachment never comes through.
HWD
  • 1,547
  • 7
  • 36
  • 72
18
votes
5 answers

line break problem with MultiCell in FPDF

I am using the Java port of FPDF. I am encountering the following errors. When I call multicell two times, every time the text is printed on a new line. MultiCell(0, 1, "abcd", currentBorders, Alignment.LEFT, false); //prints on one…
user156073
  • 1,933
  • 8
  • 31
  • 37
1
2 3
99 100