0

enter image description hereHere my requirement is set trim box for creating PDF using xetex, but the PDF not generated with trim box. Please provide a solution to fix this, here my TeX code

MWE:

\documentclass{book}
\usepackage{atbegshi}

% MediaBox can be fixed like so:
\makeatletter
\AtBeginShipout{\AtBeginShipoutAddToBox{
  \special{pdf:put @thispage <<
    /MediaBox [0 0 612.00000 792.00000]
  >>}
}}

% other boxes

\special{pdf:put @pages <<
  /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} 
  • Why are you putting the trimbox into @pages instead of as /Mediabox into @thispage? – Ulrike Fischer Apr 5 at 14:57
  • not sure if it was ever added see old answer tex.stackexchange.com/a/49093/170109 however depends on how you look at it but if crop box is same as media box trim is outside both according to acrobatusers.com/tutorials/finding-page-boundaries – user170109 Apr 5 at 15:23
  • Here I want page layout for my PDF with trim, bleed and crop box. Here I attached image and highlight my requirement for your reference – Rajesh Kumar Apr 8 at 7:54
1

According to the PDF Specification, only the MediaBox and CropBox are inheritable.

Also, the default value of CropBox is the value of MediaBox, so you don't have to specify it in your case.

This means, you should put the MediaBox into the @pages object and the BleedBox and TrimBox into the @thispage object.

\documentclass{book}
\usepackage{lipsum}
\usepackage{atbegshi}

\special{pdf:put @pages <<
  /MediaBox [0 0 612.00000 792.00000]
>>}

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

\begin{document}
\lipsum[1]
\clearpage
\lipsum[2]
\end{document} 
  • thank you very much. You did a great job to me. Your answer exactly fulfill my requirement thanks again for your timely response :):). – Rajesh Kumar Apr 8 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.