latex3 / pdfresources

LaTeX PDF resource management
LaTeX Project Public License v1.3c
22 stars 5 forks source link

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

Open khzimmer opened 1 year ago

khzimmer commented 1 year ago

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

u-fischer commented 1 year ago

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.

khzimmer commented 1 year ago

That's great. Thank you. :)