View Issue Details

IDProjectCategoryView StatusLast Update
0000995luatexluatex bugpublic2017-03-27 17:09
Reporterrwirth Assigned ToHans Hagen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Summary0000995: Embedding object via `\immediate\pdfextension obj` causes large parts of the PDF being written uncompressed
DescriptionI'm using LuaTeX 0.95.0 (TeXLive 2016) on Arch Linux.
When I embed an object via \immediate\pdfextension obj the size of the output PDF rises dramatically because large (all following?) parts of the file are now written uncompressed.
Steps To ReproduceMWE:

\documentclass{minimal}
\usepackage{lipsum}

\begin{filecontents}{embed.file}
Embedded File
\end{filecontents}

\immediate\pdfextension obj file{embed.file}
%\immediate\pdfobj file{embed.file} % for pdfLaTeX

\begin{document}
 \lipsum
\end{document}

LuaLaTeX: Resulting file size is 28,903 Bytes
Without the embedded object: 21,320 Bytes
Compare pdfLaTeX: 21,441 Bytes with embedded object, 21,349 Bytes without.
Additional InformationTriggered the problem while trying to embed an ICC profile.
Current workaround is embedding the object at the end of the document

\AtEndDocument{
  \immediate\pdfextension obj file{embed.file}
}

Brings file size down from 950k to 250k for my 30-something-page document.
TagsNo tags attached.

Activities

Hans Hagen

2017-01-19 19:22

manager   ~0001660

this can relate to the macro package setting object compression so a pure low level tex example demonstrating this is needed (maybe begindocument sets the compression or so)

rwirth

2017-01-20 13:58

reporter   ~0001669

\input plipsum

\immediate\pdfextension obj file{embed.file}

\lipsum{1-3}
\bye

21,916 Bytes with embedded obj, 19,262 Bytes without.
Using the same `embed.file` (130 Bytes) that was generated by the LaTeX MWE. The file with the embedded object doesn't have any compressed object streams (/Filter/FlateDecode is not present in output PDF) while all streams in the file without the embedded object are compressed. Exchanging the lipsum and the embed has no influence on file size.

If I do

\lipsum{1-3}
\vfill\eject
\immediate\pdfextension obj file{embed.file}

to ship out the page before adding the object, the whole file is compressed and it stays that way when I add further text or pages. The first page seems to be magic.

luigi scarso

2017-01-23 09:30

developer   ~0001670

I cannot reproduce it with luatex 1.0.1
# cat test-2.tex
\input plipsum

\immediate\pdfextension obj file{embed.file}

\lipsum{1-3}
\bye

# luatex test-2.tex
This is LuaTeX, Version 1.0.1 (TeX Live 2017/dev)

Output written on test-2.pdf (1 page, 19342 bytes).

# cat test-3.tex
\input plipsum

%\immediate\pdfextension obj file{embed.file}

\lipsum{1-3}
\bye

# luatex test-3.tex
This is LuaTeX, Version 1.0.1 (TeX Live 2017/dev)
Output written on test-3.pdf (1 page, 19253 bytes).

Issue History

Date Modified Username Field Change
2017-01-18 22:33 rwirth New Issue
2017-01-19 19:22 Hans Hagen Note Added: 0001660
2017-01-20 13:58 rwirth Note Added: 0001669
2017-01-23 09:30 luigi scarso Note Added: 0001670
2017-03-27 17:09 Hans Hagen Status new => closed
2017-03-27 17:09 Hans Hagen Assigned To => Hans Hagen
2017-03-27 17:09 Hans Hagen Resolution open => fixed