5

With pdflatex, I used to write \pdfcompresslevel 0 and \pdfobjcompresslevel 0 before the \documentclass command. This would disable the PDF compression which in turn speeds up the generation of the PDF file.

However, these commands do not seem to work with LuaLaTeX. Is there a way to speed up the generation of the PDF file, e.g., by also disabling compression?

Sven
  • 221
  • Have you tried {\pdfvariable compresslevel}? See TUGboat, Volume 37 (2016), No. 1. Hans Hagen’s article on LuaTEX 0.90 backend changes. – Thérèse Feb 03 '21 at 20:02
  • Do you have any benchmarks showing that pdf compression slows down the document generation? I highly doubt that this has any effect on speed. My measurements were all within the same range. – topskip Feb 04 '21 at 08:44

2 Answers2

8

I use (in texlive 2022)

\RequirePackage{expl3}
\ExplSyntaxOn
\pdf_uncompress:
\ExplSyntaxOff
\documentclass{article}
 ....

or (with the new pdfmanagement + latex-dev 2022-06-01)

\DocumentMetadata{uncompress}
\documentclass{article}

to get uncompressed pdf. That works for all engines.

Ulrike Fischer
  • 327,261
  • Ulrike, I don't know what changed, but at the moment I had to require expl3 instead of l3pdf (and not requiring anything, found a defined \pdf_uncompress: but missed compression levels along the way). – gusbrs Jun 01 '22 at 19:51
  • @gusbrs l3pdf is gone, it is now in l3kernel, I updated the answer – Ulrike Fischer Jun 01 '22 at 20:21
  • That's what I assumed. Thanks! I'm not sure when and why explicitly loading expl3 is still needed, but it's working good. :) – gusbrs Jun 01 '22 at 20:23
  • @gusbrs one must load expl3 to force the loading of the backend driver as uncompressing is backend dependant (as the question shows ...). – Ulrike Fischer Jun 01 '22 at 20:29
  • Got it! Thanks again. – gusbrs Jun 01 '22 at 20:31
2

After \edef\pdfcompresslevel{\pdfvariable compresslevel} \edef\pdfobjcompresslevel{\pdfvariable objcompresslevel} you have the mentioned commands as in pdfTeX.

However, the speed problem is in LaTeX itself, no in compression PDF. I am using OpTeX with LuaTeX and I don't have problems with speed.

wipet
  • 74,238