4

I want to convert the php file into pdf file, i don't know how to convert it. can any one help me?

Mohammad hayajneh
  • 623
  • 2
  • 11
  • 32
magna
  • 293
  • 4
  • 5
  • 13
  • 2
    More information please. You could just open the PHP file in a text editor, hit "print", and send it to a PDF printer (e.g. CutePDF). But I hardly believe this is what you want. – tdammers Jan 11 '11 at 09:17
  • possible duplicate of [Convert HTML + CSS to PDF with PHP?](http://stackoverflow.com/questions/391005/convert-html-css-to-pdf-with-php) – Benjol Jan 13 '11 at 13:14

4 Answers4

2

It depends on what you actually need "converting". If you want to create a PDF from PHP then there are of lots of libraries to allow you to do it. You can also build a HTML page and have that convert to a PDF too. Here are a couple to take a look at

https://github.com/dompdf/dompdf

http://www.fpdf.org/

Fabien Ménager
  • 140,109
  • 3
  • 41
  • 60
Rich Standbrook
  • 648
  • 7
  • 20
2

from what you described I understood that you want to convert a php file to a pdf file

to do that:

first install a virtual printer that handles pdf (for example, install adobe reader - it's free, it will automatically install an "Adobe PDF" printer)

then open the file in any editor and do a print, but from the printers dialog, select the "Adobe PDF" printer. it will save your file as a pdf

if you open the php file in an editor that supports source formatting (coloring etc) like Notepad++ for example, printing it to pdf will keep the formatting

Andrei S
  • 6,486
  • 5
  • 37
  • 54
0

You can do it through a shellcommand with wkhtmltopdf. This can allow you to get the html printed from the php to be converted into a pdf which then can be downloaded (or displayed).

Sondre
  • 1,878
  • 18
  • 33
0

You can use http://www.freepdfconvert.com/ to convert it online to pdf but you must save the .php file as .txt first.

T1000
  • 2,909
  • 7
  • 36
  • 53