User Tools

Site Tools


doc:appunti:prog:pdf

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
doc:appunti:prog:pdf [2026/02/06 12:15] – [Creazione PDF da pagine SVG] niccolodoc:appunti:prog:pdf [2026/04/03 16:25] (current) – [Rimuovere la password di un file PDF] niccolo
Line 222: Line 222:
 Al posto di **PROMPT**, che chiede la password da stdinput, si può indicare la password direttamente sulla riga di comando. Al posto di **PROMPT**, che chiede la password da stdinput, si può indicare la password direttamente sulla riga di comando.
  
 +===== Ridurre la risoluzione delle immagini in un file PDF =====
 +
 +<code bash>
 +#!/bin/sh
 +
 +# ~72 dpi, ~150 dpi, ~300 dpi
 +#RESOLUTION='screen'
 +RESOLUTION='ebook'
 +#RESOLUTION='printer'
 +
 +INPUT="$1"
 +if [ ! -f "$INPUT" ]; then
 +    echo "Usage: $(basename "$0") [INPUT.PDF]"
 +    exit 1
 +fi
 +
 +OUTPUT="$(echo $INPUT | sed 's/.pdf/.reduced.pdf/')"
 +if [ -f "$OUTPUT" ]; then
 +    echo "ERROR: Output file already exists: $OUTPUT"
 +    exit 1
 +fi
 +
 +gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/"$RESOLUTION" \
 +   -dNOPAUSE -dQUIET -dBATCH \
 +   -sOutputFile="$OUTPUT" "$INPUT"
 +</code>
  
doc/appunti/prog/pdf.txt · Last modified: by niccolo