Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things


by BigBoffin (Initiate)
on Nov 20, 2000 at 22:46 UTC ( #42554=perlquestion: print w/replies, xml ) Need Help??
BigBoffin has asked for the wisdom of the Perl Monks concerning the following question:

Greetings my brothers and sisters of the faith.

I run a humble mission in one of the distant shores of the internet. 
I spend much time preaching the wisdom of perl, and my time among the 
unwashed masses has been rewarding as I have converted a few to the 
path of perl.

Recently...a problem was presented. The problem was the need to create on
demand pdf documents of html content for web users to create and download.
Blessed with some wisdom...I insisted on a long period to do a feasibility
analysis before promising anything(I do that anyway for most things).

Naturally, in keeping with perl traditions, I scoured the net seeing if this
problem has been tackled before. I was hoping for a quick HTML2PDF::Simple 
on CPAN but no luck :)

I did find an HTML to postscript but that is all. Dear followers of the 
P.E.R.L (Path of Enlightened and Righteous Learning) I seek your wisdom
in this matter.

Any help will be appreciated,


Replies are listed 'Best First'.
by little (Curate) on Nov 21, 2000 at 03:50 UTC
    You can download the full PDF Reference (PDF: 4.3 MB / 696 pages)(second edition) as a PDF file
    (book normally published by Addison Wesley) from Adobe and there are even more documents about that available in theirDeveloper Program.

    PDF is using the "way cool" plain text format to stay portable, so it's easy to process :-)
    e.g. you can view and edit the contents of any PDF file with a text editor.

    To convert HTML to PDF you could use the pdflib which is a commercial Code library with function wrappers for perl java and C++ and .. BUT thats some bucks to pay (for commercial use). The Author also wrote a book about PDF and as well how to use his library.
    But still you need to translate the HTML to the appropriete PDF descriptors.
    An Idea here seems to be parsing existent HTML but to go on the reight side it seems much better to use XML as a BASE and produce HTML and PDF from it.
    Thats the way I do but as I don't own the rights of the code produced I cant post that. sorry
    On CPAN you'll find some modules when searching for PDF, as merlyn suggested.

    There are also some packages around on the net that support a wide range of PDF, e.g. search C|NET or other scripting archives. There are a few - just search.

    Have a nice day
    All decision is left to your taste

    UPDATE also interesting is first alpha release (v1.0a24) of PDF on the Fly, a Perl5 library for creating PDF files
by maverick (Curate) on Nov 20, 2000 at 23:07 UTC
    If you're on Linux, there is a ps2pdf converter that works well (I used it for my resume). If all else fails you could pipe the output of the html to ps converter you found through the ps2pdf converter.

    I did find a HTML to LaTex converter on CPAN. and there's a Latex to PDF converter (texi2pdf) on Linux. Maybe you'll have to do a two step process.


by merlyn (Sage) on Nov 21, 2000 at 01:39 UTC
Re: HTML 2 PDF (tools, PM threads)
by ybiC (Prior) on Nov 21, 2000 at 03:45 UTC
by KM (Priest) on Nov 20, 2000 at 22:57 UTC
    You may want to search this site, I know this topic has been discussed. Also, search CPAN for Pdf (, there are modules for creating PDFs. You should also do a search on Google for 'html2pdf', which will also lead you to some possible solutions.


by lemming (Priest) on Nov 20, 2000 at 23:08 UTC
    I don't think you're going to find anything easy. I took a look at Adobe, but didn't find anything that fits. I did find they offer PDF -> HTML.
    <A HREF=">PDF -> HTML

    And here's some more info. A good collection of white papers on the end which if it doesn't work out will at least support your position.
    More Adobe Web stuff

    UPDATE: Ack. in the time it took me to put my post, better info surfaced. Well, I need to look a bit harder or type in something different to Google. At least my links have OK info.
    More links:
    Free PDF
    Next one does have some Perl info: HTML becomes PDF
by $code or die (Deacon) on Nov 21, 2000 at 00:02 UTC

    You can also check out SANFACE who have written quite a few utils for doing what you want - some freeware and some shareware. IIRC, the scripts there don't convert directly from html, but make it possible to generate pdf files from html forms with links, different fonts and maybe images as well.
(Dermot) Re: HTML 2 PDF
by Dermot (Scribe) on Nov 21, 2000 at 00:09 UTC
by otijim (Acolyte) on Nov 20, 2000 at 22:53 UTC
    I'm probably wrong (so please correct me
    and expand my knowledge also) but I don't think
    Adobe has released their PDF format and you have to use
    and Adobe product to do anything with a PDF format

    (This isn't an educated answer, or well it was educated
    awhile ago, but things change to fast and I don't have time
    to keep up!!! :)
      I'm probably wrong (so please correct me

      Ok, you are wrong :) You can write raw PDF, and there are tools to do so. Searching Google for <something>2pdf will give you places to look for conversion tools, which don't always need any Adobe product to write the file.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://42554]
Approved by root
[karlgoethebier]: good morning all

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2018-01-19 10:39 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (217 votes). Check out past polls.