Anyone with Drupal to PDF experience?

davidneedham's picture

stpaultim and I have been working on an ongoing support project that has been a little tricky. The client wants to be able to generate a single PDF download that combines a number of specific nodes from the site. We've been able to use the Views PDF module to create the PDF download, but the formatting within the document is pretty bad (and the functionality overall is a little unpredictable).

Anyone else have experience with this module or functionality? Can we buy you a drink to talk it over?


Google Chrome PDF print?

lunk_rat's picture

Hi David,

I have been down this road and have experienced the pains of accomplishing this.

May I ask who is the end-consumer of this PDF? In two cases I was able to simply ask my client to use Google Chrome's excellent "Print to PDF" feature to print a Drupal page. This gave them the PDF they needed.

Of course this does not work if your goal is to generate a hyperlinked PDF for anyone to download from the site. I just figured that I would suggest this because I wish someone would have when I was fiddling with PDF modules.

Thanks for the suggestion!

davidneedham's picture

Thanks for the suggestion! Unfortunately it needs to be a little more flexible than that. Essentially the client would like to maintain a series book chapters that are edited independently, but provide a link to download the entire book via PDF.

I believe the simplest solution is to maintain the content in two places (one in their text editor of choice and another on the website), but that doesn't appear to be an option.

We've had no problem creating a content type for book chapters, then using views and Views PDF to aggregate and put them into one file. The real problem has been getting the chapter titles, headers/footers, and other general formatting to be uniform.

Oh – and there are tables, but that's a different problem entirely. :-)

Other Custom Options

dandaman's picture


I have, on some projects, made more custom solutions. That is, using libraries like Zend_PDF or tcpdf to basically custom draw all of the PDF bits. Basically, it is pretty involved, writing a PHP command to draw every line, block of test, etc. It's may be a bit more time-consuming than you would like, but you can get the display however you like if really needed.

Taking a look at the Views PDF module page, it does seem it uses TCPDF, so maybe you can modify the Views PDF to look a bit better somehow, I'm not sure. Hope all this rambling helps out a little bit with your issue.


davidneedham's picture

Hey Dan - thanks for the suggestions. I was hoping to not have to code it by hand, but you're right and that may have to be done.

author as ebook option

keithm's picture

Hey David,

This may be much different direction than you're up for, but I've done some experiments using Drupal as an eBook authoring platform. The ePub3 format is just a container for HTML5/CSS files. Once you have the HTML5 content and CSS3 styles in a Drupal site, it is pretty straightforward to generate ePub3 files. It's custom code but this step can use Drupal rendering libraries and is much easier than the low level PDF coding dandaman wrote about. Anyway, from there, you have a variety of options for getting from ePub to PDF format. Hope this helps.

Thank you keithm

lunk_rat's picture

Very nice, I am glad I followed this thread because using is a great idea. Thank you keithm!

Interesting! I hadn't

davidneedham's picture

Interesting! I hadn't considered that solution before. Thanks for the suggestion keithm!

Another alternative -- Cloud Convert

ivanstegic's picture

Converting to PDF is a real pain, in general. The libraries are finicky, the configuration is unstable (no matter what you do) and it's never easy. We've had to deal with the same issues for clients in the past, and now we actually have the same issue with a client that we inherited. The option is to rewrite the custom integration that we were given, or to find another alternative. We are currently evaluating the API -- there's a PHP library wrapper, small volume traffic is free and it seems to be a really good alternative. We actually started talking about it today, so no more info is available right now... but we're hoping for good things! And, it takes it totally offsite and no worries about config. Probably a chance for a new module for the integration? Not sure.

Thanks Ivan!

davidneedham's picture

Thanks Ivan! The epub option sounds really promising for us (since we're looking at hundreds of pages and is legitimately more of a book), but let's keep talking about this. There may be some opportunities here for collaboration if Cloud Convert is a real slamdunk.

Les Lim's picture

It uses wkhtmltopdf, which is essentially the same as Chrome and Safari's built-in print to PDF rendering engine. The results are much better than I expected after previous experience with tcpdf and mPDF.

If you can install wkhtmltopdf on your production server, you might be able to skip the third-party service entirely. There's a Drupal module here:

It's API-only, though, so you'd have to write code to use it.

The project closest

keithm's picture

to the epub file generation function I was talking about appears to be, which in turn uses to package the content into an epub 3 file.

The Drupal platform (as usual) gives lots of flexibility in structuring the content. In my case I wanted considerable flexibility in creating the table of contents and spine, so I didn't end up using epub_export - but you get to decide.

You might also decide that having an ebook version as an end product isn't such a bad thing either :)

Mid-Atlantic USA

Group organizers

Group events

Add to calendar

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: