Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a PDF file with PHP? [duplicate]

Tags:

php

pdf

Possible Duplicates:
Convert HTML + CSS to PDF with PHP?

I am working with my new project. I want to generate a new PDF file with the help of PHP code.

How can I do this? Do you any have any ideas?

like image 445
magna Avatar asked Jan 12 '11 07:01

magna


People also ask

How create PDF in PHP explain with example?

php require('./fpdf. php'); $pdf=new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial','B',16); $pdf->Cell(40,10,'Hello World! '); $pdf->Output(); ?> Upon execution, the PHP script will generate a PDF file in your browser.

Can PHP output PDF files?

$pdf=new FPDF(); Example 1: The following example generates a PDF file with the given text in the code. The file can be downloaded or previewed as needed.


2 Answers

You can try free libraries like fPdf

FPDF is a PHP class which allows 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.

like image 171
Ahmet Kakıcı Avatar answered Oct 01 '22 19:10

Ahmet Kakıcı


Look into Zend_PDF from Zend Framework - it allows you to create/manipulate PDFs.

like image 36
StasM Avatar answered Oct 01 '22 20:10

StasM