-1

I am making an app that creates an invoice. It is created in HTML and PHP using different data from a database.

I need to create a function that converts the page into a PDF and send it to a client.

I can not store it on server as it would mean to create a few hundred everyday. I need something like "http://FreeHTMLtoPDF.com/?convert=".$strBillURL; but it's not working any more.

Many thanks if you can help me!

Vlad Eugen Nitu
  • 195
  • 2
  • 15

1 Answers1

1

I prefer to generate PDF files using some library that converts HTML/CSS to PDF. One of the libraries that provides this and is very easy to use is mPDF: https://github.com/mpdf/mpdf

I have no information regarding what type of PDFs you generate, but in my projects I tend to generate them on the fly from the data in the database and do not store them at all.

There are also other options available for converting HTML to PDF, like wkhtmltopdf, but they might require additional knowledge in set up: https://github.com/wkhtmltopdf/wkhtmltopdf

Ingus
  • 176
  • 4
  • Thank you for the fast answer! I will try it. The one I gave as example was returning the pdf directly but I think this works too. – Vlad Eugen Nitu Jan 12 '16 at 11:30
  • Any idea how can I also get the value of an input's placeholder? Or at least how I can get a session variable in a JQuery script. I'm a bit tangled here... – Vlad Eugen Nitu Jan 12 '16 at 12:12
  • Hey man, do you think you could give me a hand if you got some spare time? I read about the libraries but I am a beginner and I'm not getting it to work. I get the invoice to show properly on page and I want to mail it to someone as a pdf attachment but without storing it on the server. Is that possible? – Vlad Eugen Nitu Jan 13 '16 at 10:24