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
6
votes
1 answer

Python: Coloring cells in FPDF is not working?

I'm using the FPDF library to create a PDF, and I was looking to color the cells on my document. I looked through the API and found out that this is the way to do it: fpdf.set_fill_color(r: int, g: int = -1, b: int = -1) So I go ahead and do this…
secretagentmango
  • 619
  • 2
  • 10
  • 17
6
votes
1 answer

How to write output data into pdf?

I can't find a way how to write output data (lists or function return) into pdf in python. This is my simple code. I want to write the i of data list line by line in pdf. But the output shows only [1,2,3,4,5,6]. Which pdf module is would be better…
Swe Zin Phyoe
  • 149
  • 1
  • 2
  • 11
6
votes
2 answers

How to add FPDF totals to the last row of tables?

I have a set of tables categorized by their source e.g: "Client", "Stock", "Floorstock". They look like this: Each contain lists of prices, which need to be added up and totaled on the last row of the tables. I'm having problems linking a…
hello world
  • 306
  • 1
  • 6
  • 28
6
votes
1 answer

Edit existing PDF file using FPDF

I have been search throughly on Google and stackoverflow, but it looks like I don't find any "clear" information regarding edit existing PDF file using FPDF ... So, what I wan't to do is add a controlled copy marking on every PDF download from my…
Didit Dwianto
  • 316
  • 1
  • 3
  • 6
6
votes
1 answer

PHP and FPDI/FPDF: Fatal error: Uncaught Exception: FPDF error: Incorrect output destination

I have a PDF file, and I want to add a new page with FPDI/FPDF Fatal error: Uncaught Exception: FPDF error: Incorrect output destination: outfiles/111111.pdf in C:\wamp\www\pdf\fpdi\fpdf.php on line 271 ( ! ) Exception: FPDF error: Incorrect…
user3282262
  • 75
  • 1
  • 4
6
votes
1 answer

Return PDF generated with FPDF in Flask

I can generate a PDF with an image using the code below. How can I return the generated PDF from a Flask route? from fpdf import FPDF pdf = FPDF() img = input('enter file name') g = img + '.jpg' pdf.add_page() pdf.image(g, 50, 50) pdf.output(img +…
user3891081
  • 93
  • 1
  • 7
6
votes
4 answers

Write text over image using FPDF

I want to generate PDF. I am using FPDF to generate pdf file. I generate the pdf with the content text and image. Now i want to make the image as background image. So the scenario is text would be over image. I tried many solution but any…
TMA
  • 1,419
  • 2
  • 22
  • 49
6
votes
2 answers

Display image in PDF using fpdf

I want to insert an image in my created PDF file. However, it won't position well at all. If I do this: $fpdf->Image($row_products['prod_imagelarge'], 10); The images will appear however, they're too big. If I do…
anonymous123
  • 845
  • 4
  • 13
  • 16
6
votes
3 answers

How to embed fonts with FPDF and mPDF

I'm trying to embed Helvetica Neue into my PDF, but all of the resources I find online are overly complicated and filled with what I think is unneeded information. Can anyone point me to a step by step tutorial of how to include fonts in…
Carson
  • 4,541
  • 9
  • 39
  • 45
6
votes
2 answers

Send FPDF document with PHPMailer;

I am currently trying to generate a pdf with FPDF and then send it in an email with PHPMailer. I know that the PHPMailer functionality is working, and I can create the pdf. But when i try to download the pdf to the server first, output($pdf,"F"), I…
Anthony
  • 233
  • 4
  • 14
6
votes
2 answers

Background Color inside a cell is not changing in fpdf

Im using fpdf to generate a pdf file for my reports and Im new to this. I want to change the fill color inside a cell but whenever I reloaded the page, nothing hapeens, It still the same white fill color. Here is my code :
Larcy
  • 289
  • 3
  • 8
  • 18
6
votes
4 answers

TCPDF twice as slow as FPDF with same code

I currently use FPDF to create some fairly complicated reports and am trying to upgrade to TCPDF, but I've found that my same code running through TCPDF is about twice as slow. Because my PDFs already take up to a minute to generate I can't really…
Jacob
  • 105
  • 2
  • 3
  • 9
6
votes
5 answers

FPDF error: Alpha channel not supported:

I am trying to generate PDF from HTML (output of a PHP file). I am using FPDF to generate the PDFs. I have three PNG transparent images (Alpha channel), that go on top of each other and it looks like one image. The minute FPDF encounters the first…
Farid Siddiqui
  • 165
  • 2
  • 2
  • 13
6
votes
2 answers

Adjust font size FPDF

In FPDF I have a cell with a width of 176mm where I need to put a client name. The problem is that the client name doesn always adjust to that fixed width. Is there a way to make the font size of the cell autoadjust to the cell width in case it is…
Tales
  • 1,829
  • 3
  • 33
  • 50
6
votes
3 answers

FPDF / FPDI addPage() Orientation

I'm using the following code to add a new page to my existing PDF document and save it. require('addons/fpdf.php'); require('addons/fpdi.php'); $pdf = new FPDI(); $pagecount = $pdf->setSourceFile($orgpdfpath); for($i = 1; $i…
mmackh
  • 3,550
  • 3
  • 35
  • 51