2

Please suggest me how to fix trim, bleed and art box in xelatex. Here I used the below code it supports only in pdflatex not for xelatex. It will be grateful someone can provide the better solution. Thanks!

MWE:

\documentclass{book}   

\makeatletter    
\pdfpageattr{
/MediaBox [0 0 612.00000 792.00000]
/BleedBox [81.0 63.0 531.0 729.0]
/CropBox [0 0 612.00000 792.00000]
/TrimBox [90.0 72.0 522.0 720.0]
}

\makeatother

\begin{document}
Between 200BC and 100BC, during the Han Dynasty, the Chinese used matrix-type methods with the text \textit{Nine chapters on the mathematical art}. There was further development, but it was not until 1683 when the idea of a determinant appeared in Japan when Seki wrote \textit{Method of solving the dissimulated problems}. This used matrix methods in tables in the same way as the earlier work of the Chinese. Ten years later the determinant first appeared in Europe in the work of Leibniz. The word determinant was first introduced by Gauss in 1801 while discussing quadratic forms, but Cauchy in 1812 used determinant in the modern sense.

Between 200BC and 100BC, during the Han Dynasty, the Chinese used matrix-type methods with the text \textit{Nine chapters on the mathematical art}. There was further development, but it was not until 1683 when the idea of a determinant appeared in Japan when Seki wrote \textit{Method of solving the dissimulated problems}. This used matrix methods in tables in the same way as the earlier work of the Chinese. Ten years later the determinant first appeared in Europe in the work of Leibniz. The word determinant was first introduced by Gauss in 1801 while discussing quadratic forms, but Cauchy in 1812 used determinant in the modern sense.
\end{document}
TeXnician
  • 33,589

1 Answers1

8

The dvipdfmx/ Xe(La)TeX equivalent of \pdfpageattr is @thispage, which allows adding PDF code to the current page object using the pdf:put special:

\special{pdf:put @thispage << ... >>}

Settings made with \pdfpageattr are applied to all pages that follow its call. With XeTeX/dvipdfmx however, the effect of @thispage is limited to the current page. To extend it to multiple or all document pages the above-mentioned special must be repeatedly inserted.

\documentclass{book}
\usepackage{atbegshi}

\AtBeginShipout{\AtBeginShipoutAddToBox{
  \special{pdf:put @thispage <<
    /MediaBox [0 0 612.00000 792.00000]
    /BleedBox [81.0 63.0 531.0 729.0]
    /CropBox [0 0 612.00000 792.00000]
    /TrimBox [90.0 72.0 522.0 720.0]
  >>}
}}

\begin{document}
Between 200BC and 100BC, during the Han Dynasty, the Chinese used matrix-type methods with the text \textit{Nine chapters on the mathematical art}. There was further development, but it was not until 1683 when the idea of a determinant appeared in Japan when Seki wrote \textit{Method of solving the dissimulated problems}. This used matrix methods in tables in the same way as the earlier work of the Chinese. Ten years later the determinant first appeared in Europe in the work of Leibniz. The word determinant was first introduced by Gauss in 1801 while discussing quadratic forms, but Cauchy in 1812 used determinant in the modern sense.

Between 200BC and 100BC, during the Han Dynasty, the Chinese used matrix-type methods with the text \textit{Nine chapters on the mathematical art}. There was further development, but it was not until 1683 when the idea of a determinant appeared in Japan when Seki wrote \textit{Method of solving the dissimulated problems}. This used matrix methods in tables in the same way as the earlier work of the Chinese. Ten years later the determinant first appeared in Europe in the work of Leibniz. The word determinant was first introduced by Gauss in 1801 while discussing quadratic forms, but Cauchy in 1812 used determinant in the modern sense.
\end{document}
AlexG
  • 54,894
  • After compiling your example with xelatex I get the following result from pdfinfo: Creator: XeTeX output 2019.10.09:0943 Producer: xdvipdfmx (20190503) [...] Page size: 612 x 792 pts (letter) (rotated 0 degrees) MediaBox: 0.00 0.00 612.00 792.00 CropBox: 0.00 0.00 612.00 792.00 BleedBox: 0.00 0.00 612.00 792.00 TrimBox: 0.00 0.00 612.00 792.00 ArtBox: 0.00 0.00 612.00 792.00 File size: 11491 bytes Optimized: no PDF version: 1.5 – andc Oct 09 '19 at 06:45
  • BleedBox, CropBox and TrimBox all are equal to MediaBox. – andc Oct 09 '19 at 06:47
  • 1
    @andc You are right, only the CropBox is inheritable acc. to the PDF specification and can be set in the root node of the page tree. The other boxes must be set for every page individually. I edited my answer accordingly. Thanks! – AlexG Oct 09 '19 at 09:26