Google Answers Logo
View Question
Q: generating pdf documents online ( Answered 5 out of 5 stars,   3 Comments )
Subject: generating pdf documents online
Category: Computers > Software
Asked by: till-ga
List Price: $10.00
Posted: 23 Aug 2004 02:47 PDT
Expires: 22 Sep 2004 02:47 PDT
Question ID: 391324
Im looking for a solution to generate pdf documents online. I can use
CGI scripts or php programs on my server. The server I use is not a
windows but a unix style server. So software based on the windows
world is not an option.

What I want to do is: I generate a HTML page from a perl script and
want to have an option to send this page to a PDF generator that will
convert it to PDF format.
The software must be independed of any special modules that could be
available on servers as I don not run the server myself. My provider
will not support the installation of special modules on the server.

Any ideas ?

Request for Question Clarification by palitoy-ga on 23 Aug 2004 04:17 PDT
Hello Till

Have you tried FPDF?
"FPDF is a PHP class which allows to generate PDF files with pure PHP,
that is to say without using the PDFlib library. The advantage is that
PDFlib requires a fee for a commercial usage. F from FPDF stands for
Free: you may use it for any kind of usage and modify it to suit your

FPDF has other advantages: high level functions. Here is a list of its
main features:

 Choice of measure unit, page format and margins 
 Page header and footer management 
 Automatic page break 
 Automatic line break and text justification 
 Image support (JPEG and PNG) 
 TrueType, Type1 and encoding support 
 Page compression"

Let me know if this solution fits your needs and I can post it as an
official answer.

Clarification of Question by till-ga on 23 Aug 2004 05:02 PDT
How do I send a HTML page to this program ? As stated in my question
Im looking for a software that creates a pdf when you send a HTML
page as a parameter.
"19. Can I convert an HTML page to PDF with FPDF?
No. But a GPL C utility does exist, htmldoc, which allows to do it and
gives good results:"

So this one is not an option for me. 


Request for Question Clarification by eiffel-ga on 24 Aug 2004 02:51 PDT
Hi Till,

It's not quite clear to me what your constraints are. Would this be an
acceptable solution:

1. A command-line software application that converts an HTML file
(either stored, or from standard input) to a PDF file (on standard

2. The above application is supplied as source code written in C - but
it is a complete application not a programmer's library. The
application is free and is written to be compiled with cc or gcc on
Unix or Linux.

3. You compile the application (preferably on your provider's server,
but otherwise on a compatible machine).

4. You copy the resulting executable to your provider's server and
call it from a short PHP script (that basically writes an
"application/pdf" header to standard output then calls the HTML-to-PDF
conversion utility in "passthru" mode to put the PDF on standard
output to be served by the webserver.

This solution does not require your provider to install any special
module onto their webserver, but it does require that you can run your
own executable on the server (called from a PHP script).


Clarification of Question by till-ga on 24 Aug 2004 03:27 PDT
Hi eiffel-ga and thanks for your efforts. But I cant compile any
programs on this server as I do not have a telnet access.
Seems my question is much more complicated than expected.


Request for Question Clarification by andyt-ga on 27 Aug 2004 19:22 PDT
I found html2pdf-- which I
think solves your problem.  It's based off of fpdf, so I dont think
you'll need any modules installed.  If this answered your question,
let me know and I'll post it as an answer.


Clarification of Question by till-ga on 30 Aug 2004 11:10 PDT
Hello andyt-ga,

although there are still some problems (errors when wirting out pdf
datas) I will accept you good research work as an answer.

Subject: Re: generating pdf documents online
Answered By: andyt-ga on 30 Aug 2004 14:48 PDT
Rated:5 out of 5 stars
Hello til-ga
As mentioned above, html2pdf is a solution for generating html to pdf
without the use of php modules.   it can be downloaded from at

There are several examples here:  I
tried one of them and it worked for me, except for some missing css,
which I think is a known problem.

What sort of problems are you having with writing out pdfs?  If
there's php errors then it might be that you need to set the
permissions correctly on the scripts, or something else.

html php fpdf
till-ga rated this answer:5 out of 5 stars and gave an additional tip of: $5.00
Thank´s a lot. I had been looking for such a script for a long time.

Subject: Re: generating pdf documents online
From: eiffel-ga on 24 Aug 2004 05:10 PDT
There seem to be plenty of options available.

1. Are your pages static? If so, convert them on your computer with a
utility such as HTML_ToPDF and upload them to your provider's server.

2. Does your provider have html2ps and ps2pdf installed? If so, you
can probably run HTML_ToPDF on your provider's server (it's written in

3. Are your pages dynamic? If so, create them directly in PDF with the
excellent FPDF package (a PHP class). Forget about the intermediate

4. htmldoc does EXACTLY what you want, so why not change to a provider
that will let you run htmldoc?

5. Or set up your own server on a DSL line, and lose all restrictions!

Subject: Re: generating pdf documents online
From: till-ga on 24 Aug 2004 07:32 PDT

Im working on a project for one of my customers and he does not want
to change his webhosting provider.
The pages to be converted to pdf are generated by a cgi script
dynamically, downloading is not an option as my customer wants the pdf
to be created online for his customers.
Maybe fpdf could be an option, but I do not know how to setup the
program as Im not familiar with php programming.
I was looking for a solution, not for a programming interface. Seems
such a solution does not exist.

Subject: Re: generating pdf documents online
From: andyt-ga on 06 Oct 2004 15:26 PDT
Thanks for the tip and rating Till!


Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy