Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Web-based PDF export

by Spidy (Chaplain)
on Jan 08, 2007 at 20:21 UTC ( #593619=perlquestion: print w/replies, xml ) Need Help??
Spidy has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, fellow monks.

A friend and I are working on developing a trading card game. In order to make it easier to keep track of the cards that we have designed we want to store all of their data in a MySQL database, and be able to go a page, click on 'export card template', and have a PDF exported that contains all of our card designs, laid out the way we want them to be laid out.

In order to do this, my idea was to have a CGI script that reads the data out of the database and then generates a PDF using a template for each different type of card. However, I am unsure of how to do this, along with what modules I would need to look into. Can anyone point me in the right direction?


Replies are listed 'Best First'.
Re: Web-based PDF export
by davidrw (Prior) on Jan 08, 2007 at 20:30 UTC
    PDF::API2 can read in a pdf template and write stuff on top of it..

    as for the db part, DBI is the way to go -- see the Tutorials for a good starting place
Re: Web-based PDF export
by shonorio (Hermit) on Jan 08, 2007 at 21:19 UTC
    Maybe Catalyst with Template Toolkit and Latex plugin can be a choice for you system.

    Solli Moreira Honorio
    Sao Paulo - Brazil

Re: Web-based PDF export
by jbrugger (Parson) on Jan 09, 2007 at 06:36 UTC
    Or use Apache fop.
    See this node for more information.
    Next, i'd suggest to stay away form PDF::API2, it gave me unsolvable problems.
    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
      I'm not an expert, but I thought the XSL-FO stuff (which fop seems to be a variant of?) didn't support pictures? A trading card game would probably need that.

      For a trading card game, you'd need some checksum and ID build into the files. Comments are possible in pdf (and all image formats, afaik) and could store the checksum and id. Hmmm.. a web interface that took an uploaded image and gave verified owner and correctness? Fun project.

      (-: And for economics -- a Magic The Gathering clone playable and storable over the net... what a neat way to steal children's money. Please remember me when you guys start hiring! :-)

Re: Web-based PDF export
by Praveen (Friar) on Jan 09, 2007 at 10:34 UTC
    Try This Cpan Modules PDF-Create-0.01 & CGI
    Else chk with Acrobat SDK
    You can write a plug-in through Acrobat SDK for batch process
Re: Web-based PDF export
by DrHyde (Prior) on Jan 09, 2007 at 10:14 UTC
Re: Web-based PDF export
by Tatnall (Beadle) on Jan 10, 2007 at 19:25 UTC

    I've used PDF Template, which uses PDFLib and is supposed to support PDF::API2 in an upcoming release.

    It uses XML and a HTML::Template like interface to build the PDF. It's worth taking a look at.

    "Recognizing who we aren't is only the first step toward knowing who we are." - Os Guinness
Re: Web-based PDF export
by j3 (Friar) on Jan 11, 2007 at 06:44 UTC

    ... a PDF exported that contains all of our card designs, laid out the way we want...

    Not sure exactly what you mean by ``card designs'', but if it's just text, a very simple way to do it that I'd try would be to pull the data out, then (possibly using HTML::Template) drop it into a Plain TeX file and process that file with pdftex returning the pdf to the user.

    I haven't yet looked into how to get graphics in, but TeX is great for making beautiful pdf's.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://593619]
Approved by GrandFather
Front-paged by Corion
and the monks are chillaxin'...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2018-06-18 02:15 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (107 votes). Check out past polls.