2

This question already has an answer here:

Is it possible with XeTeX to generate linearized PDF for Web streaming — showing pages sequentially as they are downloaded —, not for file size reduction?

marked as duplicate by Martin Schröder, AlexG, Paul Gaborit, Schweinebacke, Zarko Mar 10 '17 at 9:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I just realised I should not do that, as explained in bugs.ghostscript.com/show_bug.cgi?id=694099 — basically, linearized PDF is deprecated for a decade now, being incompatible with PDF 1.5 cross-referenced PDFs. – lfd Mar 10 '17 at 13:59
3

Web-optimized PDF requires PDF objects sorted linearly and the xref table, which is the list of the object's byte offsets, be put at the beginning of the file.

Web-optimization is necessarily a post-processing action, applied on a readily written, first "draft" of a PDF file, where all PDF objects are known. XeTeX won't do this, as it does not validate an already existing PDF file. Nor does any of the other TeX engines.

The command-line tool qpdf could be used for that purpose.

From the qpdf manual page:

The qpdf program is used to convert one PDF file to another equivalent PDF file. It is capable of performing a variety of transformations such as linearization (also known as web optimization or fast web viewing), ...

qpdf --linearize input.pdf optimized.pdf

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