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
10
votes
5 answers

FPDF add new font

I'm using the FPDF library for PHP to generate reports, but now I need to use another font (Verdana) that isn't in the core fonts. I added the line: $pdf->AddFont('Verdana','','verdana.php'); I copied the files verdana.php and verdana.z to the…
Marco Muciño
  • 620
  • 2
  • 9
  • 19
10
votes
7 answers

FPDF: Change text color while inside a Cell?

I want it so that the text saying white will use SetTextColor as white, and the orange to use orange. $pdf->SetTextColor(255,255,255); $pdf->Cell(50,0,'WHITE ORANGE ORANGE WHITE',0,1,'C'); How do I affect the 'ORANGE' words to use an orange text…
Michael Crothers
  • 191
  • 3
  • 3
  • 10
9
votes
3 answers

png images to one pdf in python

I have a list of .png images. I need to convert all of them into one pdf, 9 images per page , but not to place them one after another vertically, but fill in all the width, and only then continue to next row. Amount of pictures can be different…
Yuliya
  • 163
  • 1
  • 2
  • 6
9
votes
3 answers

FPDF error: Unable to find "startxref" keyword

I have an app that renders PDFs with FPDF. It was working fine and for some reasons I had to change the PDF files and now I get this error: Unable to find "startxref" keyword If I restore the original files, the same error happens. How do I fix…
Mr.Web
  • 6,992
  • 8
  • 51
  • 86
9
votes
2 answers

Preserve internal links using FPDI

I'm trying to dynamically add some text to an existing pdf file. I've tried both FPDF and TCPDF combined with FPDI to import the existing pdf. That's ok. But, as expected, all existing links from the original pdf are gone. Then, I tried to…
9
votes
12 answers

TCPDF ERROR: Unable to create output file

I'm trying to generate pdf with the combination of TCPDF and FPDI. Here is my code. require_once('../tcpdf/tcpdf.php'); require_once('../FPDI/fpdi.php'); $fileName = '../sample.pdf'; class PDF extends FPDI { /** * "Remembers" the template id of…
Linga
  • 10,379
  • 10
  • 52
  • 104
9
votes
2 answers

FPDF - Drawing a line that's centred across the width

Im trying to produce a PDF document using the PHP FPDF library, Im trying to draw a line horizontal over the page which is indented the same amount both on the left and right sides. Im having real difficulty trying to accomplish this. My code is as…
BigJobbies
  • 3,633
  • 11
  • 43
  • 66
9
votes
4 answers

Undefined font: In Fpdf

I'm New to Fpdf library, i need to create a pdf from data base in smarty. i have checked the data from data base is fine, when pass the font name the below error was show Warning: in_array() expects parameter 2 to be array, null given in…
mohan
  • 453
  • 1
  • 5
  • 17
9
votes
1 answer

How do I underline text using FDPF in PHP?

I'm trying to make my text underlined in FPDF but it seems to be impossible... I'm not using HTML. I'm using an DejaVu unicode font, which supports UTF-8, and also its my first time working with the FPDF. Is that even possible? Please give me some…
Scott
  • 5,991
  • 15
  • 35
  • 42
9
votes
3 answers

How do you make a table like this with FPDF using PHP?

How do you make a table like this with FPDF using PHP? I can't seem to figure out how to do this with $this->Cell.
Heather McVay
  • 939
  • 3
  • 15
  • 31
8
votes
6 answers

Why is there a left padding in a cell using FPDF in php?

I am printing a cell using the FPDF(http://www.fpdf.org/) class in php. The cell should be placed into the top left corner. Everything works great, except that a left padding is added inside the cell. Here is my code: $pdf = new FPDF('L', 'mm',…
zeckdude
  • 15,877
  • 43
  • 139
  • 187
8
votes
2 answers

Positioning text over pdf file in PHP

I'm developing an e-Certificate web page. I've managed loading the certificate template and writing on top of it (Attendee Name, Event Title and Event Date). But in positioning those three pieces of information, I couldn't position them at the…
Learner
  • 611
  • 3
  • 12
  • 28
8
votes
1 answer

positioning the cell in pdf using fpdf

I am trying to make a pdf from the data entered by the user in a form. I am using fpdf to do this. As of now I have something like this for adding the data to the pdf -…
user2636368
  • 622
  • 4
  • 10
  • 20
8
votes
3 answers

Placing two MultiCells next to each other using FPDF in PHP

I trying to create a custom table using FPDF Cell/MultiCell. My 1st cell is a MultiCell that has two lines of text. The next cell should then just be placed right next to it. Problem : no matter what I do to the next cell, it is always on the next…
Pierre Pretorius
  • 461
  • 3
  • 8
  • 16
8
votes
4 answers

Is there a way to set the DPI of output pdf using FPDF library?

Is there a way to reduce the DPI of an output pdf without affecting its size using FPDF library?
Abhishek
  • 838
  • 1
  • 6
  • 9