Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Consider the following simple tex file, to be compiled with pdflatex.

\pdfcompresslevel=0
\documentclass{standalone}
\begin{document}
\hrulefill
\end{document}

Thanks to \pdfcompresslevel=0, the resulting pdf file is human readable. One can find the following lines:

4 0 obj <<
/Type /ObjStm
/N 4
/First 22
/Length 257       
>>
stream
2 0 1 105 5 139 6 191
% 2 0 obj
<<
/Type /Page
/Contents 3 0 R
/Resources 1 0 R
/MediaBox [0 0 343.711 0.398]
/Parent 5 0 R
>>
% 1 0 obj
<<
/ProcSet [ /PDF ]
>>
% 5 0 obj
<<
/Type /Pages
/Count 1
/Kids [2 0 R]
>>
% 6 0 obj
<<
/Type /Catalog
/Pages 5 0 R
>>
endstream
endobj

As far as I understand, a call like 5 0 R refers to the object defined by 5 0 obj. Such an object seems indeed to be defined but with a leading % that is supposed to be the comment char in pdf format.

So two questions.

  1. Is my analysis right?
  2. Why does pdftex output such comments (I mean why does it output % 2 0 obj)?
share|improve this question
add comment

1 Answer 1

up vote 13 down vote accepted

What you see is not the completely un-compressed PDF. To get such, you will have to say

\pdfcompresslevel=0
\pdfobjcompresslevel=0

There are two different levels of compression according to the PDF specification.

The first one, controlled by the value of \pdfcompresslevel in the pdftex driver, deals with the content streams of page objects, XObjects, embedded files and others, that is, data enclosed between stream and endstream keywords.

Secondly, PDF objects of a PDF file can themselves be packed into content streams of container objects of type /ObjStm. This is controlled by \pdfobjcompresslevel.

Since, in the example code, \pdfcompresslevel is set to zero, the content stream of the /ObjStm object No. 4, as listed in the second code box, is not compressed. One can see the objects that are packed into it. The commented object numbers are only there for information.

share|improve this answer
    
Thank you so much: it's clearer now. This was turning me absolutely mad. –  cjorssen Dec 12 '13 at 12:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.