Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by dragonchild (Archbishop)
on Dec 02, 2005 at 16:44 UTC ( #513640=note: print w/replies, xml ) Need Help??


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

The problem with this, and I should have posted this initially, is that while the datasource remains the same, the Excel, PDF, and HTML portions have very different look-and-feel requirements. For example, a set of images might be required in the PDF that's different from the HTML and that cannot be displayed in the Excel. The difference might be something as simple as a reversed image (instead of white on black, it's black on white).

The second issue is headers and footers. HTML and Excel don't have them, but PDF does.

And, that brings up the general issue of pagination. HTML doesn't paginate the same way PDF does, and Excel is different yet again. (I won't even start with RTF.) You'll end up with a really bad PDF if you attempt to PDF-ize an HTML document.


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?
  • Comment on Re^2: PDF::Template redesign - I want your ideas!

Replies are listed 'Best First'.
Re^3: PDF::Template redesign - I want your ideas!
by xdg (Monsignor) on Dec 02, 2005 at 20:40 UTC
    The second issue is headers and footers. HTML and Excel don't have them, but PDF does.

    As per my earlier post -- you can utilize the proposed W3 extensions for this. For example, see this fragment taken from CSS Print to put a running page count at the bottom of pages:

    <style> @page { counter-increment: pages; @bottom-center { font-family: Times, Palatino, serif; font-size: 12pt; font-weight: normal; content: "Page " counter(pages); } } </style>

    Sure, a lot of these standards are proposed/preliminary, but I think they offer a good place to start because a group of people have already been thinking about these sorts of challenges.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re^3: PDF::Template redesign - I want your ideas!
by cyclist38 (Hermit) on Dec 02, 2005 at 16:54 UTC
    PDF'ing an HTML page almost always ends up badly anyway. Each time I generate a PDF with the same data as used in an HTML page, I end up using TT (well close to every time). Using TT would definitely be my choice here.
Re^3: PDF::Template redesign - I want your ideas!
by eric256 (Parson) on Dec 02, 2005 at 16:54 UTC

    You missed my point.

    Instead of having the template portion (control constructs etc) as part of the module, all the modules should use the same template. Then each module expects different data. So control flow and variable insertion remains the same, yet formating would be independent. So a PDF template might have header and footer tags, while xls has row and colum stuff, regardless they all still use the same loop, if, var code from the basic template. Code reuse 101 ;)


    ___________
    Eric Hodges $_='y==QAe=e?y==QG@>@?iy==QVq?f?=a@iG?=QQ=Q?9'; s/(.)/ord($1)-50/eigs;tr/6123457/- \/|\\\_\n/;print;
      That's why I was thinking about trying to use TT in some fashion. That way, you have the same constructs from TT, but you do still have a separate template file for each output format.

      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?

        If it comes down to it and you have a choice, leave it so the user can choose any template backend they like. Somethings are easier in HTML::Template while others need the power of TT, I've found TT harder in the general cases to work with and avoid it unless I need its features.


        ___________
        Eric Hodges $_='y==QAe=e?y==QG@>@?iy==QVq?f?=a@iG?=QQ=Q?9'; s/(.)/ord($1)-50/eigs;tr/6123457/- \/|\\\_\n/;print;
Re^3: PDF::Template redesign - I want your ideas!
by holli (Abbot) on Dec 02, 2005 at 19:07 UTC
    HTML and Excel don't have them, but PDF does.
    Regarding Excel there is not a Header/Footer per se, but you can define rows and columns that repeated on each printed page. That's are pretty much the same.


    holli, /regexed monk/

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2021-10-28 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (96 votes). Check out past polls.

    Notices?