Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\DocumentMetadata{} disables stream uncompression for dvips #48

Closed
muzimuzhi opened this issue Mar 4, 2023 · 3 comments
Closed

\DocumentMetadata{} disables stream uncompression for dvips #48

muzimuzhi opened this issue Mar 4, 2023 · 3 comments

Comments

@muzimuzhi
Copy link

muzimuzhi commented Mar 4, 2023

l3build's regression-test.tex sets

  \special{%
      ps: /setdistillerparams
      where
        {pop << /CompressPages false /CompressStreams false >> setdistillerparams}
      if
    }%

to uncompress pdf generated by ps2pdf.

But if \DocumentMetadata{} is used, the /Type/Metadata object in pdf is no longer uncompressed and one has to pass -dCompressStreams=false to ps2pdf to re-enable uncompression (latex3/l3build#278 (comment)). See an example diff here

The .tpf files in current repo's directory testfiles-dvips also reflect this difference. Thus I suppose this is a known problem/limitation.

% \DocumentMetadata{}
\input regression-test\relax
\documentclass{article}

\begin{document}
text
\end{document}

From the intermediate ps files, it seems with \DocumentMetadata{} the corresponding special is inserted too late:

 %%Page: 1 1
-TeXDict begin 1 0 bop 515 440 a
+TeXDict begin 1 0 bop -600 -600 a
+ [{ThisPage}<<>> /PUT pdfmark
+ -600 -600 a 515 440
+a
  /setdistillerparams where {pop << /CompressPages false /CompressStreams
 false >> setdistillerparams} if
@u-fischer
Copy link
Member

Without \DocumentMetadata you get the xmp-metadata added by Ghostscript; with \DocumentMetadata the one added by the pdfmanagement code. Ghostscript honors then that there are user metadata and doesn't add its own, but it offers no option to add it as an uncompressed stream (I had a discussion about that https://bugs.ghostscript.com/show_bug.cgi?id=705962) and imho it doesn't react to the /setdistillerparams either. The only way to uncompress it is to pass the options (in the few tests I have I normally use \DocumentMetadata{xmp=false} as I didn't want to bother with this).

@muzimuzhi
Copy link
Author

It seems https://bugs.ghostscript.com/show_bug.cgi?id=705962 only tells there's no way to uncompress the xmp stream solely, but didn't clearly say the /setdistillerparams setting is not honored (on xmp stream added by the pdfmanagement code). Is it?

@u-fischer
Copy link
Member

I retried. Even if I put the special in the background hook (where it is then before the pdfmark) the XMP stays compressed.

\AddToHook{shipout/background}{ \special{%
      ps: /setdistillerparams
      where
        {pop << /CompressPages false /CompressStreams false >> setdistillerparams}
      if
    }}%
\input regression-test\relax
\DocumentMetadata{}
\showoutput
\documentclass{article}

\begin{document}
text
\end{document}

So I think there is nothing one can do unless ghostscript changes something and I'm closing here for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants