Edit3: I've updated the title, hopefully satisfying the people saying this item is off-topic: The reason I think this post does have value to this community is that the answer maybe off-topic (i.e. a bug in
qpdf), but the question definitely was not. I spent quite some time fiddling with the Beamer frames that appeared to be the culprit, so let's hope this item can save others the effort.
BTW: I just send a message to Jay on the
qpdf issue, referring to this post.
I have a PDF document generated using
pdflatex, and I used
qpdf to linearize it. The initial document reads and checks fine, while the linearized document has the first pages damaged and produces an error at checking:
(object 269 0, file position 307): expected n n obj
It's a Beamer presentation including a lot of screengrabs. I thought I found the frame responsible (outcommenting it makes the problem disappear), but the frame looks fine, and even replacing it with a copy of the next frame generates the same problem. And nothing suspicious before it.
Displaying the linearized document using evince gives me a lot of empty pages at the start and errors like this:
Syntax Error (4697): No font in show/space Syntax Error: Unknown font tag 'F21'
Any ideas on how to solve this problem or how to debug it?
For those willing to try to linearize themselves: here's the document (warning: 50MB download):
(link edited to make room for linearized document)
I also tried
pdfopt, creating a linearized document that appears to be just fine. Checking it with
qpdf, however, results in a core dump.
I'm wondering whether it's a problem with qpdf instead of an issue within the document...
Edit: I'm ignoring the
qpdf core dumping for now; the file generated by
pdfopt seems to work in Acrobat Reader and Firefox (both on Linux), though Firefox is not showing the document until it has been downloaded completely. Need to look into that.
Edit2: Just checked out the
pdfsizeopt tool suggested by Keks (tnx!). It requires
tif22pnm, for which RPM packages can be found, but also
pngout, that hasn't been updated for Linux for almost a decade. Looks like a Windows-only party, so I'll leave this for now.
pdf2ps followed by
ps2pdf does indeed create a smaller PDF document, but it makes me lose all hyperlinks and meta-data. Will report back on