[geeks] Text to PDF (was Re: I need an HTML to PDF converter)

Sheldon T. Hall shel at tandem.artell.net
Wed Feb 22 12:13:31 CST 2006


Brian Dunbar says ...
> Sheldon T. Hall wrote:
> > Folks-
> >
> > I need a converter that will take HTML and spit out PDF
> > files, do it from
> > the UNIX command line, as a batch process.  There will be
> > hundreds of files
> > to convert per day, so it needs to be amenable to running
> > from a shell
> > script without any user intervention.
>
> How odd.  I was looking a problem yesterday with similar intent.
>
> We have a form on a web page, currently PHP.  We'd like to take their
> Name, slam that into a PDF file with legal boiler plate
> around and fire
> it back at them - by their own request of course!
>
> It looks like a way would be to use PHP to build the text - with the
> variable buried in it - then use enscript to create the PS from text,
> then ps2pdf for the PDF file.
>
> PHP > *text_file* > enscript > *PS_file > PS2DF > *PDF_file*
>
> Making life complicated the boiler plate has it's own font,
> the headers
> another, and several sections are in bold with underline.
>
> Am I guilty of complicating this process?

I dunno.

In my case, no users are involved, nor is a webserver, directly.  The HTML
in question is a bunch of reports generated in the past and saved in a
database.  The client wants to extract a selection of those reports, convert
the HTML to PDF, and then store the PDF files in another database.

They generate, and store in the DB, several hundred HTML reports per day.
Once the backlog gets converted the plan is to go to a once-per-day cron job
to convert the HTML reports stored since the last time the conversion
process was run, or some such.  In fact, I expect we'll have to have a DB
that tracks which HTML reports have been converted, etc.

-Shel



More information about the geeks mailing list