General discussion


Generate PDF on the fly on Linux

By oc34 ·
I would like to Generate PDF on the fly. Basically, I need to be able to grab information from mysql and generate a Certificate or Diploma on the Fly.

I found this site that sells the PDFLib and just wondering if you know of any other open Source or similar product that I can use.

Thank you.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

lots of ways

by Jaqui In reply to Generate PDF on the fly o ...

cups, html2pdf being 2 that are included with all distros.

the cups system has the biltin ability to print to pdf. you can have a script send the file to cups, then direct cups to create a pdf, and have the server send the pdf to the required location.

generate html from the sql query results, then send that to html2pdf ( could actually be pdf2html, but it does work both ways I beleive.
then send the resulting pdf to where it's needed.

Collapse -

The most reliable way I know of

by Oz_Media In reply to Generate PDF on the fly o ...

BUY Adobe Acrobat and use the Distiller to create PDF's from the print command, just like sending to a printer.

No it isn't free but is is the best PDF creator I've ever used and it builds nicely comressed files.

Collapse -

Free and easy

by dproske In reply to The most reliable way I k ...

you can use sql to create a spreadsheeat and then use open office to create PDF.

Collapse -

I don't use OO for PDF creation

by Oz_Media In reply to Free and easy

I find the graphics compression and file sizes aren't as good as Adobe's. I require online sharing and editing functionality too that even the last Acrobat couldn't provide.

While I am an OO advocate, I find it's best used for those who don't fo a LOT of PDF editing/sharing.

Collapse -

acrobat on linux?

by Jaqui In reply to I don't use OO for PDF cr ...
Collapse -

tools are already there

by mickey In reply to Generate PDF on the fly o ...

Since you have the smarts to use mysql you are most certainly using linux.
Linux has the script ps2pdf native with most any distro. setup this script then install the Apple Color LW 12/660 Postscript driver.

Simply direct your printing to the virtual printer and your PDFs will be generated automaticlly.

Setup instructions are in the script.

it will also log your print jobs in the log file defined by the LOGFILE variable

Have fun....

# ver 1.3.5
# Mickey Poppitz, DataSoft
# mickey@(you guested it .com)
# script to enable samba printing to PDF files
# - add printer def to /etc/samba/smb.conf (remove #'s to enable in)
# - place script in /opt directory
# - chmod 777 /opt
# - chmod 777 /opt/*
# - thats it, PDFs will be placed in the directory
# defined by the $OUTDIR variable

# script usage
# samba prn definition
# [PDFprinter]
# comment="samba PDF printer engine"
# print ok = yes
# quest ok = yes
# path = /opt
# create mask = 0777
# print command =/opt/ %d %u %s %J %H %a %I
# force create mode = 0777
# where;
# %d = $1 current server process IP
# %u = $2 samba user
# %s = $3 session
# %J = $4 windows job name
# %H = $5 users home dirsctory
# %a = $6 clien pc type (win98,winNT,... or UNKNOWN)
# %I = $7 client IP address

# path in PDF printer def of smb.conf if different,
# make sure samba "path" and WORKDIR are the same

# dir where PDFs will be put
# IE "public" share

JOB=`basename $3|cut -f2 -d"."`
# write Samba ENV vars into logfile
DATE=`date +%b%d-%H%M%S`
echo "$DATE - $1 - $2 - $3 - $4 - $5 - $6 -$7 " >> $LOGFILE

if [! -f $LOGFILE ]; then
touch $LOGFILE
chmod 777 $LOGFILE

# convert ps file to PDF and place in user's home directory
/usr/bin/ps2pdf $WORKDIR/$3
#/usr/bin/ps2pdf $WORKDIR/$3 $WORKDIR/$2.$4.pdf

sleep 3

# remove ps file when done
mv $WORKDIR/$3.pdf $OUTDIR/$2.$4.$JOB.pdf
rm $WORKDIR/$3
# end script

Collapse -

Postscript File

by jmgarvin In reply to Generate PDF on the fly o ...

You could just generate a ps file rather than a PDF...

Related Discussions

Related Forums