-1

We are migrating our web app from Adobe Coldfusion/Windows to a Railo/Linux environment, and are having issues with inconsistent PDF rendering with cfdocument between the platforms. As well as default ACF (apparently iText 2.1.0) and the default railo (PD4ML) PDF engines, we have also tried PD4ML Pro v3.8.0fx3 and flying saucer to try and get accurate representation of HTML in a PDF doc (with mixed results).

Some specific issues we are facing relate to font alignment, font size, borders with thickness > 1px, table cell borders, absolute positioning of elements (flying saucer), z-index of images (default ACF).

Although the HTML we are using is user generated by various WYSIWYG editors and far from perfect, none of the aforementioned tools can render PDFs in the same way that any modern browser will.

We are looking for a tool that will generate PDFs that closely match the way HTML is rendered in the browser, has anyone overcome a similar problem who is willing to share which tool they use?

jade
  • 25
  • 1
  • 6
  • have you considered adopting something much more simple and "flat" like the rst syntax ? https://en.wikipedia.org/wiki/ReStructuredText – user2485710 Jul 01 '13 at 01:12
  • Are you looking for a library you can use to code up a solution, or a works-out-of-the-box application? – Stobor Jul 01 '13 at 01:13
  • @Stobor, i would prefer a solution that works out of the box – jade Jul 01 '13 at 07:06
  • @jade Half the answers to http://stackoverflow.com/q/968201/ support PDF output... – Stobor Jul 01 '13 at 11:30

4 Answers4

0

You can configure OpenOffice to run in headless mode. Then send it the HTML document, and a command to produce a PDF.

Bob Dalgleish
  • 8,167
  • 4
  • 32
  • 42
0

My company's built an HTML to PDF API called DocRaptor. We have better CSS support than a lot of other APIs.

All plans come with a 30 day trial and unlimited test documents.

We've got a Java example here: DocRaptor Java example

https://docraptor.com/

illbzo1
  • 480
  • 3
  • 13
0

I've been using flying saucer for a couple of years now and have yet to run into any problems. I produce PDFs using ACF 9 and CKeditor. Check it out: https://github.com/flyingsaucerproject/flyingsaucer.

Sorry, just noticed you already tried flying saucer... I also recommend just using iText and XMLWorker.

Demo: http://demo.itextsupport.com/xmlworker/ Docs: http://demo.itextsupport.com/xmlworker/itextdoc/flatsite.html

0

You can use WKHTMLTOPDF:

sudo apt-get install xvfb
sudo apt-get install wkhtmltopdf
sudo echo 'xvfb-run --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf $*' > /usr/bin/wkhtmltopdf.sh
sudo chmod a+x /usr/bin/wkhtmltopdf.sh
sudo ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf
wkhtmltopdf http://www.google.com google.pdf

Credits to http://www.mycodingtips.com/html-page-to-pdf-from-linux/