Forum Moderators: coopster & phranque

Message Too Old, No Replies

Creating PDF files on the fly on server?

Is it possible to create simple pdf's from a database?

         

louponne

10:40 am on Dec 3, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does anyone know of scripting possibilities to create simple pdf files, that would be sent to download or browser, from a few fields of a database? I've done some extensive searching on-line, and all I have found is a rather expensive script called "PDFever".

sugarkane

10:50 am on Dec 3, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You might want to take a look at this Perl Module [sourceforge.net]

I've no experience with it, but it looks like a decent starting point.

dabrisz

2:48 pm on Dec 3, 2001 (gmt 0)

10+ Year Member



Great Topic. I have been looking for this for months. Is there anything else out there in something other than perl?

I did find this article [15seconds.com...]
But have not had time to work with it.

louponne

3:11 pm on Dec 3, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for your relies!

To be complete, I had also found:

[soupermail.sourceforge.net...]
This perl script is a very powerful mail/mailing-list/etc tool, that I've used before for its multiple-form-handling abilities. But it's rather hard to use, and I'd rather have something dedicated to pdf creation. Also, I don't think that soupermail could create the pdf from a database.

[perlstudio.de...]
quote from site: <<PDFever™ is an OO-Perl library for creating PDF files dynamically on servers -- or on your desktop computer if you want. You use an XML or Perl program to do the job. Include an image? Embed a font? Create a push-button? Set security? No big deal, one tag is fine.>>
price: $395. Cough, cough.

Anyone have any other ideas, or has anyone used the PDF::Create ?

hollowearth

4:35 pm on Dec 3, 2001 (gmt 0)



I'm also trying to work out pdf generation from databases, using PHP not perl though:
[php.net...]

seriesint

4:39 pm on Dec 3, 2001 (gmt 0)



Here's an idea from wdvl, use another program to create the PDFs. Didn't see if the HTMLDOC program was pay or free for commerical use but it has to be less than the 300 program you mentioned.

[wdvl.com...]

And I took a quick peek at PDF::Create, oh man that's like let me learn how to build a PDF from scratch, ick.

As for the other solutions, I believe PHP offers built-in PDF support (it has a PDF section listed in ORA's Webmaster In A Nutshell) and I think almost all the major scripting languages have something that will output PDF. ASP might need a COM Object though.

A good resource is [planetpdf.com...] , although it came up with nada on this query. It
still has some good resources, articles etc.

HTH
later

lawman

8:39 pm on Dec 3, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm paying a guy to help me with a .pdf format questionnaire on my website. Once it's complete, I'll let you know if and how it works.

Lawman

Tapolyai

12:40 am on Dec 4, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As hollowearth said PHP has "built-in" PDF capabilities.

I have used the PHP implementation of PDF (PDFlib) and it is excellent solution to generate and modify documents on the fly.

louponne

10:06 am on Dec 5, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



great - thanks for all your answers. PHP sounds like the way to go.

seriesint

7:00 pm on Dec 5, 2001 (gmt 0)



no not PHP ;)
Seriously though I looked at that PDF::Create module and it's fairly straight forward. After a few minutes I had a simple cgi script up that would take input and output a single page PDF file for download. I'd give ya'll the preview but the admin on my test server thought "booting off the RAID mirror" sounded fun, three days later I'm still without a real dev server.

I realize the problem for most people using the script would be line breaks in the file. This lead to a simple line breaking algo. Pass in the text/paragraph and a width parameter like & paragraph("$para", "60") will print out up to 60 chars wide. It works pretty good for simplistic content. Definable title, paragraph and sub headers. Stuck with a single font at the moment but it works. If you are interested in the script, just give the word and I'll post/send the code. Just realize it will require that PDF::Create module on the server, some tweaking to fit other scripts and its untested outside of my use.

HTH
later
<edited: ¶ to & para>

vtlyen

1:59 pm on Jan 9, 2002 (gmt 0)




Hello seriesint,
First I downloaded the PDF-Create.zip from [aspn.activestate.com...]
Second,I installed it on my windows 2000 PC.
Third,I executed sample.pl but the debug shown a loop at line 85 when the script adds the first image.
I'm interested in having some help et getting your cgi script.

vtlyen

9:30 am on Jan 10, 2002 (gmt 0)



I fixed the previous loop issue and I'm moving forward.

sugarkane

6:39 pm on Jan 10, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to wmw vtlyen - keep us informed how you get on :)

vtlyen

6:40 pm on Jan 11, 2002 (gmt 0)



Well almost everything ok in one color (black).
My last target is having some text in color (red for errors, orange for warnings, green for standard messages). How to proceed ?

scotty

10:10 pm on Jan 13, 2002 (gmt 0)

10+ Year Member



For the Python heads, there is also the open sourced ReportLab Library [reportlab.com] that can be scripted to generate PDF on the fly. ReportLab also sells an XML based engine, which they called Report Markup Language (RML), which has quite a fancy on-line demo. But the pricing starts from $10,000 per CPU :o

9thsign

5:32 am on Feb 2, 2002 (gmt 0)

10+ Year Member



I create about 18 dynamic proposal reports with some complex calculations through ColdFusion. I use a freeware program called HTMLDOC and interface through the command line to generate the PDF's. I have over a hundred salespeople constantly hitting it everyday.

I first used a custom tag written in C++ from the allaire website that used an older version of the program, but the program kept freezing up the server(quad 1ghz)!

So I just downloaded the newest version and ran a CF script that executed the program and gives command line arguments. It's worked great since. I also implemented it through ASP. You can use it with Java, CGI and anything that can execute a program and give command line args.

vtlyen

3:17 pm on Feb 3, 2002 (gmt 0)



Last status :
thanks to many helps and $page->setrgbcolor(r,g,b);#
with r(ed),g(reen),b(lue)=number between 0 and 1, I'm generating coloured pdf files.

I've tried to generate pdf on the fly by replacing the output file by a - but I'm getting source of the pdf page. Is it related to the fact I'm testing it in a Windows 2000 and IE 5.00.3315.1000 ?
Is there any additionnal parameter ?
Any clue and suggestion are welcome.

Brett_Tabke

8:18 pm on Feb 3, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



txt2pdf:

[sanface.com...]
[sanface.com...]