[reportlab-users] Changing PDF margins?

Andy Robinson reportlab-users@reportlab.com
Tue, 3 Dec 2002 09:47:23 -0000

> What I'm hoping I can do is make a master copy with no offsets, and 
> then tweak the offsets depending on which printer the job is being sent 
> to. Is there a way of tweaking the PDF margins after the PDF is 
> created?  Or do I need to use PageCatcher to do this?
> Thanks for any advice/pointers you can provide.
> - Dan Wolfe
I see 3 approaches:
(1) Use PageCatcher to rewrite the files

(2) There are a number of 'advanced' PDF features which you could 
set with an extra line or two of code which may help.  Each
page has a 'MediaBox', which we set with our 'page size', 
and two more we don't bother with called the CropBox and
BleedBox.  Also, one or two people have been working with
embedding printer-specific tray commands, which open up
the possibility of embedding "it the printer is x, do y"
inside the PDF.  If you have time to do the experiments
and look at the PDF spec, we would be happy to post some
code here to show you how to tweak these.  But I haven't
done it myself.

(3) As a third route I would suggest parameterizing your report-generator 
script so that by default it makes the 'master', but can also make 
them for a specific printer.

Whether you do (1) or (3) you still have the choice of
generating one copy for each possible printer up front,
or generating the adjusted one on-demand.