[tex-live] How to set TrimBox, BleedBox in LaTeX + dvips

Axel Strübing axel.struebing at freenet.de
Sun Oct 4 13:59:11 CEST 2009


Feel free to adopt and/or extend my approach.

I searched hyperref before and did not find an option for setting these boxes 
except for CropBox with the pdfpagescrop option. Maybe I missed something.
If you use 
\@setPdfBox{TrimBox}{xl yl xr yr}
\@setPdfBox{CropBox}{al al br br}

to define the two PdfBoxes and call
\@setPdfBoxes
once before \begin{document} you will end up with a dvi that defines two 
postscript procedures.

This will only have any further effect if using dvips + distiller/ps2pdf 
afterwards. Exactly speaking, if the generated postscript executes bop-hook at 
the beginning of every page.

regards
Axel

Am Sonntag, 4. Oktober 2009 09:55:56 schrieb Zdenek Wagner:
> 2009/10/3 Axel Strübing <axel.struebing at freenet.de>:
> > Dear all,
> >
> > the cited question is from an old entry on the pdftex list. In my opinion
> > an answer is better placed here.
>
> That's my intention to do it in my zwpagelayout package. I often get
> responses that my files are usable but lack some PDF/X data. I know
> that there are packages that can do it but they depend on hyperref.
> Unfortunatelly, hyperref is very huge and conflicts with other
> packages (at least some versions), e.g. with Velthuis Devanagari (I
> have not tried the latest version, maybe it was fixed). I want a
> simple solution. Anyway, a file that should be used for printing and
> never for use as a hypertext document does not need hyperref. I also
> want to have my files verified on a real phototypesetter so it will
> take some time to find the solution and I will have to reread the
> specification. If someone has macros to share with me I would
> certainly appreciate it.
>
> > I did come across the very same problem David asked there.
> >
> > We can achieve this by means of the following pdfmark command '[
> > {ThisPage} << /#1 [#2] >> /PUT pdfmark'. Because all box entries besides
> > CropBox have to be specified for every single page in its pdfdict this
> > lead to using the bop-hook from dvips. I do not know if a mechanism is
> > desired for setting different values for different pages (this is
> > impossible with my implementation).
> >
> > I would be glad if someone has any suggestions or comments about the
> > following two macros.
> >
> > The first collects the box specifications in a macro.
> > \let\@processPdfBoxSpec\@empty%
> > \newcommand{\@setPdfBox}[2]{%
> >  \xdef\@processPdfBoxSpec{%
> >    [ {ThisPage} << /#1 [#2] >> /PUT pdfmark
> >    \@processPdfBoxSpec
> >  }%
> > }
> >
> > The second writes a \special and defines the postscript procedure that
> > calls the pdfmark commands that inserts the box specifications into the
> > pagedictionary. Furthermore the old definition of bop-hook (if any) is
> > saved and bop-hook is defined as the union of the old definition and
> > @setpdfboxes: \newcommand{\@setPdfBoxes}{%
> >  \ifx\@processPdfBoxSpec\@empty{\relax}%
> >  \else%
> >  {%
> >  \special{!userdict begin^^J%
> >    /@setpdfboxes{\@processPdfBoxSpec} def^^J%
> >    /bop-hook where{pop /@pdfboxbophook /bop-hook load def^^J%
> >    /bop-hook{ @pdfboxbophook @setpdfboxes } def }{/bop-hook
> > {@setpdfboxes} def^^J%
> >    }ifelse end}%
> >  }%
> > \fi%
> > }%
> >
> > \@onlypreamble\@setPdfBoxes
> > \@onlypreamble\@setPdfBox
> >
> >>Dear All,
> >>
> >>Can anyone tell that how we can set the TrimBox, BleedBox using LaTeX
> >>commands or directly in PS file using postscript commands to appear
> >>same in resulting PDF when viewed in Acrobat.
> >>
> >>I understand that in PDFLaTeX one can set this using \pdfpageattr and
> >>\pdfpagesattr but I want to know that how we can achieve same in LaTeX
> >>or in resulting PS using postscript command or pdfmarks for the same.
> >>
> >>Regards
> >>David
> >
> > regards
> > Axel Strübing




More information about the tex-live mailing list