latex3 / pdfresources

LaTeX PDF resource management

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automatically created /MediaBox entry cannot be overwritten by setting it manually.

khzimmer opened this issue · comments

Hi,
I am using LuaHBTeX, Version 1.15.0 (TeX Live 2022)
Development id: 7509

Problem: It is not possible to remove/overwrite the automatically created /MediaBox entry.

Example:

\DocumentMetadata{uncompress}
\documentclass[paper = 180bp:280bp]{scrbook}
\ExplSyntaxOn
\pdfmanagement_remove:nn{Page}{MediaBox}
\ExplSyntaxOff
\PDFManagementAdd{Page}{MediaBox}{[0\space0\space200\space300]}
\begin{document}
x
\end{document}

This appears in the PDF:

<< /Type /Page /Contents 8 0 R /Resources 6 0 R /MediaBox [ 0 0 180 280 ] /MediaBox [0 0 200 300] /Parent 10 0 R >>

So the pdfmanagement_remove call seems to be ignored, and I now have two entries, instead of just the second one.

Cheers
Karl-Heinz

Basically this is a luatex problem. Unlike pdftex the engine doesn't remove an existing /MediaBox if another one is added with the equivalent of \pdfpageattr.

I will write to the luatex list perhaps that can be improved. For now I suggest that you set the mediabox with \pageheight and \pagewidth. That works fine.

That's great. Thank you. :)