Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: PDF::Template redesign - I want your ideas!

by radiantmatrix (Parson)
on Dec 02, 2005 at 21:01 UTC ( #513719=note: print w/replies, xml ) Need Help??


in reply to PDF::Template redesign - I want your ideas!

Hey, as long as you're addressing PDF templating with a complete rewrite, I have a humble request (that is, one I'm not nearly good enough to implement myself if I *did* have the time). I'd like to see a PostScript::Template module, and then have the PDF::Template module implement the same interface for similar capabilities. Obviously, the PDF module would also have more features and options, because PDF can do a bit more than PS.

This would make it really easy to write code that generates PS files for whatever reason (say as targets to a PostScript printer), and trivially cause that code to write a PDF instead. It would be as simple as, say:

my $writer; if ($cgi->param('mode') eq 'pdf') { $writer = PDF::Template->new(@params); } elsif ($cgi->param('mode') eq 'ps') { $writer = PS::Template->new(@params); } else { ht_error("I don't know about mode '".$cgi->param('mode')."'"); }

I realize that's quite a bit more work. All I can offer is that I would use it almost immediately, and be a good source of test-driven bug reports.

tilly and dragonchild both make excellent points below. I would still very much like a way to specify whether I'm dealing with PS or PDF inside a templating system. dragonchild's solution re. placement is probably for the best. tilly's solution works well for *NIX applications, but (a)I'm cautious about depending on external apps, and (b)there's never a guarantee that thing work the same on Win32. All that said, this node's specific request is withdrawn.

<-radiant.matrix->
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
"In any sufficiently large group of people, most are idiots" - Kaa's Law

Replies are listed 'Best First'.
Re^2: PDF::Template redesign - I want your ideas!
by tilly (Archbishop) on Dec 03, 2005 at 07:33 UTC
    The ps2pdf utility works well for converting postscript to pdf.

      Yes, it does. The particular thing I had in mind was a web app that currently supplies on-the-fly generated PDF files to its users. I have had a number of requests to give users the option of PS format (for various reasons which don't matter here).

      pdf2ps doesn't, AFAIK, exist... and even if it did, I'm not sure I want to deal with the disk caching such a thing would require (I hate temporary files, and I don't use them unless I must).

      So, despite the value of your comment, I'd still like a similar interface for creating PS or PDF files.

      <-radiant.matrix->
      A collection of thoughts and links from the minds of geeks
      The Code that can be seen is not the true Code
      "In any sufficiently large group of people, most are idiots" - Kaa's Law
        I have pdf2ps on my machine. According to its documentation, it is a wrapper around gs (aka ghostscript). Taking a look at the documentation for gs, it looks like it will happily take input on STDIN and send output to STDOUT. (It says that it wants a switch to tell it that STDIN is coming on a pipe so it changes its default behaviour about when it has received all of its input.)

        I haven't played with it, but this makes it look like you can develop versions of both utilities that operate without any temporary files at all.

Re^2: PDF::Template redesign - I want your ideas!
by dragonchild (Archbishop) on Dec 06, 2005 at 01:42 UTC
    This kind of capability actually belongs in PDF::Writer, not PDF::Template. P::W is the module that P::T uses to abstract away the rendering engine. It currently provides an API over PDF::API2 and PDFlib, but there's no reason it couldn't do that for any paginated format, such as PostScript.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://513719]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (None)
    As of 2021-10-20 19:04 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My first memorable Perl project was:







      Results (81 votes). Check out past polls.

      Notices?