CSS based page numbering in PDF creation

I frequently use PDF engine for generating PDF of multiple web pages a kind of book. Though you can use engine specific switch to insert page number(s) but if you want beautiful CSS based numbering then below code can be used. Just paste the code in a .CSS file and link to your html pages.


/* Page number at the bottom of page */

@page {

@bottom-center {

content: "Page " counter(page) " of " counter(pages);

font-style: italic;

color: green

}

}

PDF creation in Perl

We in our project use HTMLDOC for PDF generation in Cent OS 5. We pass html files with some template info and run the HTMLDOC command line from perl program. This after multiple run gives me the correct PDF book with proper table of content, Index etc. The basic issue now I face with this engine is that it doesn’t support the new pdf features like PDF/A, CSS etc. and I don’t think HTMLDOC is very much in developmental mode. I want to introduce new engine to my application and tried some of the available options:

Prince:

This looks excellent and supports almost all modern PDF features. The input files can be xml, html etc and can be run as a batch process. But it has a licence fee.

PDF Reactor:

Looks fine also have the Perl wrapper for manipulating PDF but can’t run as a batch process for making single PDF from many HTML files. This can be done through Perl program by making a loop to documents which in result can produce combine PDF. Like prince it also has a licence fee.

WKHTMLTOPDF:

First thing I like about this engine is that this is a open source engine, beside being free it still supports CSS. It can be run as a batch process through Perl like HTMLDOC, prince. At first look it looks promising to me so I have decided to invest some time on it. The engine is QT and webkit based and in development phase.

I was wondering if I am missing something. Is there other engines someone has tried which go well with Perl?

Best regards,

Open source PDF engine with CSS

While looking for open source PDF generators I came across some very interesting engines available like Apache FOP and some very good PHP based engines too. My basic requirement was to run it as a batch process in Linux/Perl. The engine should supports CSS and if possible should supports PDF/A and SVG too. After doing a lot of analysis I was still not sure if all pdf issues can be solved by open source engines or not??. Then I tried my hand a bit on properitery engines like princexml and PDFReactor. They have there own advantage and disadvantages. Princexml looks really nice but there is underlying cost and also doesn’t provide interface to access the API’s for pdf manipulation. Finally I found a open source engine WKHTMLTOPDF it supports CSS and looks promising as it uses already tested rendering engine webkit .

Will share if it fits in my requirement and delivers the results.