I'm trying to dynamically create a PDF (on the server) with some text on top of a pre-defined background image. I'm using PHP and I can't seem to find anyway to do this.
I've looked into http://www.fpdf.org/ and a bunch of other options.
I'm not opposed to using Flash either if it will do the trick.
Does anyone have any ideas on how to get this to work?
With FPDF you can do it like this: $fpdf = new FPDF(); $fpdf->AddPage(); $fpdf->Image('background-image. png', 0, 0, $fpdf->w, $fpdf->h); $fpdf->Output();
$img_file = './certbg/cs. jpg'; (A) In order to display the background image properly, we have to disable auto-page-break, set the background and then restore the page break afterward - all to be done in the custom header.
With FPDF you can do it like this:
$fpdf = new FPDF();
$fpdf->AddPage();
$fpdf->Image('background-image.png', 0, 0, $fpdf->w, $fpdf->h);
$fpdf->Output();
Old question I know, but this might help someone.
You should take a look at this class, I really love it. It renders HTML to PDF, and if you define a Background-Image with CSS it will be in the created PDF.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With