How to create PDF documents

Adobe’s Portable Document Format (PDF) files have almost become the standard for preparing well-formatted documents. There are PDF readers/displayers for most web browsers, so there is no real excuse for not providing this kind of formatted document to your users if your web application demands its use. Standardized forms and statistical reports can all be drawn from a web system’s data, so it makes sense to format that data in a common layout. Adam Flaherty

Example uses for dynamically generated PDFs include orders, receipts, invoices, packing slips, event tickets, reports, certificates, booking details and anything else that would benefit from a well supported printable document format that can easily be sent to others and stored for archival purposes.

I created (and continue to develop) Docca as a web service to ease the pain of implementing dynamic PDF files from your web site or service. Docca uses bespoke layout and PDF engines to generate documents from XML based document source generated by combining JSON data and applicable templates.

In researching the challenges inherent in PDF generation and the solutions available I gathered together some related articles and the libraries they use. I hope this might help you to get up to speed quickly and find the best solution for your situation.

cheers,

Jason

 Articles

Using PDF::API2
A Tutorial by Example - This document is designed to teach you to drive PDF::API2, the most comprehensive toolkit for creating PDF files from Perl. It wont teach you PDF. If you want to learn PDF, Adobe have the full specification available for download on their website.

PDF::API2 is Underrated
This is by no means a tutorial, or even an introduction to PDF::API2 … this is more of a coredump of the part of my brain that knows PDF, so to speak.

Outputting PDFs with Django
This document explains how to output PDF files dynamically using Django views. This is made possible by the excellent, open-source ReportLab Python PDF library.

How to Generate a PDF With PHP
Creating a PDF with PHP can be relatively straightforward. However, knowing what library to use and how to deal with errors can help you cut back on the tedious work associated with generating a PDF.

How To Create PDFs in Rails
We worked with The Bill of Rights Institute recently to create an interactive digital course for American History teachers. One of the interesting challenges, among many, stemmed from the fact that the project had large sections of readable content. One of our goals was to make it easy for students and teachers to print out their reading material if and when they’re not able to read it on screen.

Generating PDFs with custom fonts using wkhtmltopdf
Generating PDF files with custom fonts can be tricky. In this tutorial we will create a simple Rails app and tackle this problem with two tools: wicked_pdf and wkhtmltopdf.

Generate PDF from HTML using wkhtmltopdf and PHP
God knows what i have tried in order to generate PDF files using php. I tried the FPDF and TCPDF library. Yes, it was easy to create simple tables, but when i came to the part which involves adding images into tables it was huge pain. I could not generate the desired layout until i found a great utility called wkhtmltopdf.

Create / Generate PDF files with TCPDF plugin
Few days ago i was playing with TCPF plugin to create a PDF files. Since i have checked few available extension and also checked some forum threads but still i dont get my expected result for PDF file.

 Libraries

 
7
Kudos
 
7
Kudos

Now read this

Building a PDF writer

A PDF file is basically a set of object serialised in a specific format similar to PostScript. Our initial goal is to be able to place text in a PDF by writing the required objects in the correct format but today we’ll just start with... Continue →