latex3 / pdfresources

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

Colour issue in LuaLaTeX when using \DocumentMetadata #50

Open juhaszp95 opened 1 year ago

juhaszp95 commented 1 year ago

Hello,

I'm trying to include a pdf figure in a document compiled with LuaLaTeX. When the figure is included without \DocumentMetadata, the colours come out correctly. (I need \DocumentMetadata to use newpax.) The above MWE also produces the correct colours if run in pdfLaTeX (but I need Lua). The figure uses transparency, which might be the source of the issue.

MWE:

\DocumentMetadata{}
\documentclass{article}
\usepackage{graphicx}

\begin{document}    
    \includegraphics{periodic bec.pdf}
\end{document}

The included figure (Inkscape svg and the exported PDF) is available here. Any help would be greatly appreciated. I view the created PDF in Adobe Reader.

u-fischer commented 1 year ago

hm, it is triggered by the pdfxid entries in the XMP-metadata. If you use \DocumentMetadata{xmp=false} is disappears (and with hyperxmp one gets it too). But I have no idea why simply declaring the xmp name space should trigger this change in Adobe Reader.

The difference between pdflatex and lualatex is that the first adds a /Group entry to the page resources. So the following works then in lualatex too:

\DocumentMetadata{}
\documentclass{article}
\usepackage{graphicx}
\ExplSyntaxOn
\sys_if_engine_luatex:T
 {
   \pdfmanagement_add:nnn{Page}{Group}
    {
     <<
      /CS /DeviceRGB
      /I~true
      /S /Transparency
      /Type /Group
     >>
    }
 }   
\ExplSyntaxOff

\begin{document}    
    \includegraphics{periodic bec.pdf}
\end{document}
juhaszp95 commented 1 year ago

Interesting. Many thanks for this, this indeed fixes my problem. I guess this is a bug, but I don't know in what exactly; if you think this is not within this package, then feel free to close this issue.