🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.linux.misc
Article #2594

Re: Shrinking huge PDF files

#2594
From: Andreas Eder
Date: Sun, 15 Nov 2026 09:50
60 lines
3425 bytes
On So 15 Nov 2026 at 00:56, Charlie Gibbs wrote:

> [Here's an on-charter post for a change...]
>
> I was given some scans of sheet music from an iPad vict^H^H^H^Huser who
> couldn't find the settings (if it has any) for its scanning function.
> As a result, she wound up with a 9-page PDF file that takes up over
> 30 megabytes.  (When I scan a similar document on my machine the file
> is about one megabyte.)  A bit of digging came up with utilities that
> tell me that her scan is in 24-bit colour at some ungodly resolution
> (using JPEG to keep it from being even bigger).
>
> I've been looking at utilities like Ghostscript, but the documentation
> is making my eyes glaze over.  Is there a guide that can help me
> re-sample the file, say to 300 dpi in monochrome?

What I do ro make pdfs smaller is the following:

# $1=input, $2=output
gs -q -dNOPAUSE -dBATCH \
  -sDEVICE=pdfwrite \
  -sOutputFile="$2" \
  -r1200 \
  -dAutoRotatePages=/None \
  -dCompressFonts=true \
  -dDetectDuplicateImages \
  -dEmbedAllFonts \
  -dPDFSETTINGS=/prepress \
  -dPrinted=false \
  $zdistill $zres \
  -f "$1"
#
# -r1200 is to avoid rendering on a tiny canvas, which can trip
#   heuristics of complicated fonts, as (relating to a Hans font) in:
#   https://bugs.ghostscript.com/show_bug.cgi?id=701753
# -dAutoRotatePages since no, we do not want pages randomly rotated.
# -dCompressFonts seems not to hurt, and can save notable space.
# -dDetectDuplicateImages similarly.
# -dEmbedAllFonts usually but doesn't always work to embed fonts,
#   except that if downscaling images with zres, have to override.
# -dPDFSETTINGS=/prepress needed for embedding with
#   45-2/watters-litigator/doc.pdf (tb140)
# -dPrinted=false is to preserve internal links within the pdf,
#   notably for the cover/cover3 in our tb*complete.pdf:
#   https://tex.stackexchange.com/questions/456896

For grayscale output, can add
  -sColorConversionStrategy=Gray \
  -dProcessColorModel=/DeviceGray \

You can find full notes (e.g., options no longer used) and runnable scripts:
https://github.com/TeXUsersGroup/tugboat/blob/trunk/misc/ps2pdf-tub
https://github.com/TeXUsersGroup/tugboat/blob/trunk/misc/ps2pdf-gray-tub

Hope this helps,

'Andreas

-- 
ceterum censeo redmondinem esse delendam
Technical Details
Message-ID: <87a4na779o.fsf@eder.anydns.info>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <Qq7KS.9052$s53.4981@fx10.iad>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Andreas Eder <a_eder_muc@web.de>
Newsgroups: comp.os.linux.misc
Subject: Re: Shrinking huge PDF files
Date: Sun, 15 Nov 2026 10:50:43 +0100
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <87a4na779o.fsf@eder.anydns.info>
References: <Qq7KS.9052$s53.4981@fx10.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sun, 15 Nov 2026 10:00:02 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2799872"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19RjRnoWyF9SCF1FooFKI7v"; posting-host="c351931d60ae800b456d30c31481758b"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:JfwefRXxJlk96HlRTUDwKqRK/Rg=
	sha1:LewgwCe5JRVpGPK4X6PmzX39bhU= sha256:kW670uJYGD+Fkg+JNSvyL0HDdXToq7GDCKCBIcd7Ceg=
	sha1:qH4HSMb01EoZ8Asvn/U1vUk8T1I= sha256:tZqyR9ewaFwVlWh1ApjhGljGjkJky5OZCMAeG3hHXWI=