0

I realize similar questions have been asked here and other places but I am having trouble finding information relevant to what I am trying to do that was written within the last 5-10 years so any help is much appreciated.

What I would like to do it have an html form that when filled out and submitted generates a PDF which is 3.5" x 2" @ 300dpi with a 0.125" bleed on all sides. The form would be simple text entries: name, email, etc and it would place them onto this premade 3.5" x 2" PDF file (a template of sorts with a background image etc) and then save a new file with the text entries added. The PDF may also be emailed after creation.

What sort of library would be best to accomplish something like this in PHP 5.2? Would I need to first create an html/css layout of the document and then convert it to a PDF? I'm feeling a bit lost here.

Josh Mountain
  • 1,888
  • 10
  • 34
  • 51
  • 1
    This is surprisingly hard to do well. See: possible duplicate of [PHP PDF template library with PDF output?](http://stackoverflow.com/questions/4416667/php-pdf-template-library-with-pdf-output) – Pekka Jan 21 '13 at 20:13

5 Answers5

2

try fpdf (free pdf) http://www.fpdf.org/ You can insert content into the pdf using fpdf's methods and you can determine the size of the document and the borders (don't know if you can specify bleed specifically). I used it to produce property brochures and posters on a commercial property website and it works well.

2

Take a look at below example with code.

http://www.tcpdf.org/examples.php

http://html2pdf.fr/en/example

Dipesh Parmar
  • 27,090
  • 8
  • 61
  • 90
1

Start from reading this tutorial. It explains how to create PDF files with a PHP library called PDFLib. It's absolutely not complicated... if fact it is harder to set it up than to use it :P

Tommaso Belluzzo
  • 23,232
  • 8
  • 74
  • 98
  • Thanks, I was briefly looking at PDFlib before - I believe I would need to purchase a comercial license from them to use it but it seems much cheaper than some of the multi thousand dollar per server options I have seen elsewhere. – Josh Mountain Jan 21 '13 at 20:19
1

you can use TableTool as you can see here:

http://datatables.net/extras/tabletools/

Zz Oussama
  • 229
  • 1
  • 12
1

Prince supports CSS properties for controlling page bleed and trim, and has been used by several customers to print business cards and similar objects.

Michael Day
  • 1,007
  • 8
  • 13