[luatex] Leaving a single PDF object uncompressed

Scott Pakin scott-lua at pakin.org
Wed Jul 6 18:13:29 CEST 2016


How can I leave a single PDF object stream uncompressed regardless of
the compression level used for the rest of the document?

For my hyperxmp LaTeX package, I need to leave the stream containing
the XMP metadata uncompressed so non-PDF-aware tools can extract it.
However, I don't want to leave the entire PDF file uncompressed just
for the sake of my one object.  In pdfTeX, I can simply set
\pdfcompresslevel=0 and create an object with \immediate\pdfobj both
within a group, and everything works.  However, LuaTeX's
\pdfcompresslevel (and now, \pdfvariable compresslevel) appears to be
a global setting, which thwarts that approach.

After a lot of searching I found that I can create an object in Lua
using "pdf.obj { compresslevel = 0, ... }" to achieve the effect I
want.  But is there a way I can do the same thing right from a
\pdfextension obj, without having to define a Lua function?  I feel
like I'm duplicating existing functionality.

Thanks,
-- Scott


More information about the luatex mailing list