For the book to be published, I need to provide a different /BleedBox for odd and even pages. I tried to achieve this through \pdfpageattr which works well if only used once in my document, for even/odd page separation, I tried:
\documentclass[numbers=noenddot,10pt,paper=155mm:230mm]{scrbook}
\usepackage[frame,width=169.8truemm,height=247.4truemm,cam,pdftex,cross]{crop}
\setlength{\voffset}{7.4mm}
\setlength{\hoffset}{7.4mm}
\usepackage{ifthen,everypage}
\newcommand{\checkthatpage}[2]{%
\ifthenelse{\isodd{\value{page}}}%
{#1}%
{#2}%
}%
\AddEverypageHook{\checkthatpage{An even page with no bleed left\noexpand\pdfpageattr{
/TrimBox [20.976 28.346 460.346 680.315]
/BleedBox [29.480 19.843 460.346 688.819]
}}{An odd page with no bleed right\noexpand\pdfpageattr{
/TrimBox [20.976 28.346 460.346 680.315]
/BleedBox [20.976 19.843 468.850 688.819]
}}}
\begin{document}
This page is:
\newpage
This page is:
\newpage
This page is:
\newpage
This page is:
\newpage
\end{document}
However with this appraoch I am not getting any boxes into the output at all, I checked the PDF in an editor. What am I doing wrong? Is it due to expansion, or because of the macro position? There is no /BleedBox in the output at all.
Bonus question: Can I automate the calculation by just setting an odd/even relative bleed margin and get the /BleedBox from the settings for the crop package?
Answer to bonus question: With the help of @Ulrike Fischer in her answer and some additions from other questions and answers, I was able to figure this out by myself, see my own answer.
\checkthatpageon every page, then there is no purpose in setting the\AddEverypageHook. I need this for a 190 page document and I cannot manually set the PDF output there. – TobiBS May 28 '20 at 17:25checkthatpage{odd}{even}gave different results to your\AddEveryPageHookI was not suggesting that you put\checkthatpageon every page but take a look at what your\AddEverypageHookdoes. – Peter Wilson May 28 '20 at 18:55\pdfpageattrwas not sent to the PDF for whatever reason. However @Ulrike Fischer provided a working solution for me. – TobiBS May 28 '20 at 19:08