in reply to multi-page from Tk::Canvas

Thanks to all for your help.

The program is a little more complicated than shown in my question. When I stated the canvas is long, it can be really long, so in actuality I have coded 2 canvases working together. One acts as a "header" and sits on top of the "data" canvas, allowing the "data" canvas to be scrolled vertically alone, or both canvases to be scrolled horizontally together (think spreadsheets).

I have already looped to break the "data" canvas into paper-sized chunks (resulting in multiple postscript files), but am still working on splicing the "header" part onto each "data" part and then combining all files into 1 file.

I think the pstops will help the most, not in itself, but as an example. I am only able use the standard perl installation (no PDF::API2) and it must be runnable on *nix and Windows.

I guess I really need to learn how to hack postscript.

Replies are listed 'Best First'.
Re^2: multi-page from Tk::Canvas
by rocklee (Beadle) on Nov 06, 2008 at 20:34 UTC

    I'll be the first to say that learning PostScript is no small task; I'm pretty sure you can get around this in cheaper ways.

    One way that needs no external tools; What about re-creating the widget(s) making up the header canvas on the data canvas? Place them on the right coordinates for page one, call postscript(), move them to coords for page two, etc.. and just destroy them once you're done printing.

    Another possibility is using ImageMagick; you can overlay images using the command-line 'composite' program (may be avaliable through a Perl binding also). This assumes, of course, that you supply a header.ps by either generating it from the header canvas or optionally supplied as a static file from Acrobat or some other tool.
    composite header.ps data.ps page.ps
    There is also most likely a way to do this using some tool/script in the 'psutils' package http://www.tardis.ed.ac.uk/~ajcd/psutils/. You can use this package to combine several .ps to one file.

    Just my two cents. If you post your "dual canvas" code, it's easier to make helpful suggestions :-)