PHP: generating PDF documents. How to create the template?
i have found this tutorial to generate a pdf.
In that tutorial there is this kind of code:
// list headers
$pdf->CreateTextBox('Quantity', 0, 120, 20, 10, 10, 'B', 'C');
$pdf->CreateTextBox('Product or service', 20, 120, 90, 10, 10, 'B');
$pdf->CreateTextBox('Price', 110, 120, 30, 10, 10, 'B', 'R');
$pdf->CreateTextBox('Amount', 140, 120, 30, 10, 10, 'B', 'R');
Should i write this kind of code by hand or there is a开发者_高级运维ny app (word processor, vectorial graphics app, what ever) where I can draw the template (size of the cells, colors, etc) of the pdf document first?
I have already created the invoice for the web using HTML/CSS.
Is my first time generating PDF documents so any advise will be wellcome.
Regards
Javi
There aren't any resources to create PDF templates for you - but you might want to look into wkhtmltopdf - which will let you convert your HTML invoices to PDFs (without needing to generate the PDF yourself).
If you already have an HTML+CSS invoice there are many options available.
wkhtmltopdf works if you are able to run binary executables on your server. dompdf or mpdf are good if you need something written entirely in php.
精彩评论