Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to linearize pdf with ghostscript

How can I linearize (web-optimize) a random pdf with ghostscript (v9.18)? I know there is qpdf, but I want to explicitly use gs.

Doing it with this command leads to a broken pdf which I am unable to open:

gs -dNOPAUSE -dFastWebView -sDEVICE=pdfwrite -sOUTPUTFILE=test.pdf -dBATCH growth_in_time_debt_aer.pdf
like image 819
Til Hund Avatar asked Sep 07 '25 15:09

Til Hund


1 Answers

Then perhaps you should report this as a bug ? Clearly a broken PDF is not intended behaviour, and the documentation is (to me at least) clear that the -dFastWebView switch is used to control linearisation.

Of course, why you would bother escapes me, very few viewers actually do anything useful with a linearised file, it can only improve the loading of the first page anyway, its incompatible with later versions of the specification, and it makes the file larger.....

like image 145
KenS Avatar answered Sep 10 '25 07:09

KenS