@@ -18,123 +18,152 @@ A temporary file is used in `mixed mode`, at the target location.
1818Better than explaining is showing it:
1919#### Checking File Information
2020```
21- $ ./pdfScale.sh -i ../input-nup.pdf
22- pdfScale.sh v2.3.7 - Paper Sizes
23- ------------+-----------------------------
24- File | input-nup.pdf
25- Paper Type | A4 Landscape
26- ------------+-----------------------------
27- | WIDTH x HEIGHT
28- Points | 842 x 595
29- Milimeters | 297 x 210
30- Inches | 11.7 x 8.3
21+ $ ./pdfScale.sh -i test.pdf
22+ pdfScale.sh v2.6.2 - Paper Sizes
23+ -------------+-----------------------------
24+ File | test.pdf
25+ Paper Type | A4 Portrait
26+ Pages | 4
27+ -------------+-----------------------------
28+ FIRST PAGE | WIDTH x HEIGHT
29+ Points | 595 x 842
30+ Millimeters | 210 x 297
31+ Inches | 8.3 x 11.7
32+ -------------+-----------------------------
33+ ALL PAGES | WIDTH x HEIGHT (pts)
34+ 1 | 595 x 842
35+ 2 | 595 x 842
36+ 3 | 595 x 842
37+ 4 | 595 x 842
38+ -------------+-----------------------------
39+
3140```
3241#### Scale by 0.95 (-5%)
3342This also shows a very special case of a PDF file that has no ` /MediaBox ` defined.
3443It is a dumb container of n-up binary PDF pages.
35- ` Ggrep ` fails, then ` PDFInfo ` fails (not installed), then ImageMagick does the job.
36- This was on CygWin64 ` @ ` Windows10 x64, MacOS would try ` mdls ` as well.
44+ ` Ggrep ` fails, then ` PDFInfo ` fails (not installed), then ImageMagick fails (not installed) and then the Ghostscript PS script does the job .
45+ This was on CygWin64 ` @ ` Windows11 x64, MacOS would try ` mdls ` as well.
3746```
38- $ pdfscale -v ../input-nup.pdf
39- pdfscale v2.4.0 - Verbose Execution
47+ $ ./pdfScale.sh -v ../input-nup.pdf
48+ pdfScale.sh v2.6.2 - Verbose Execution
4049 Single Task: Scale PDF Contents
4150 Dry-Run: FALSE
4251 Input File: ../input-nup.pdf
4352 Output File: ../input-nup.SCALED.pdf
53+ Explode PDF: Disabled
4454 Get Page Size: Adaptive Enabled
4555 Method: Grep
46- Failed
56+ Failed, trying next method
4757 Method: PDFInfo
48- Failed
58+ Failed, trying next method
4959 Method: ImageMagick's Identify
60+ Failed, trying next method
61+ Method: Ghostscript PS Script
62+ Page Range: None (all pages)
5063 Source Width: 842 postscript-points
5164 Source Height: 595 postscript-points
65+ Print Mode: Print ( auto/empty )
5266 Scale Factor: 0.95 (auto)
67+ Scale Percent: -5%
5368 Vert-Align: CENTER
5469 Hor-Align: CENTER
5570 Translation X: 22.16 = 22.16 + 0.00 (offset)
5671 Translation Y: 15.66 = 15.66 + 0.00 (offset)
57- Run Scaling: -5 %
5872 Background: No background (default)
5973 Final Status: File created successfully
74+
6075```
6176#### Resize to A0 and Scale by 1.05 (+5%)
6277```
63- $ pdfscale -v -r a0 -s 1.05 ../mixsync\ manual\ v1 -2-3.pdf
64- pdfscale v2.4.0 - Verbose Execution
78+ $ ./pdfScale.sh -v -r a0 -s 1.05 ../mixsync_manual_v1 -2-3.pdf
79+ pdfScale.sh v2.6.2 - Verbose Execution
6580 Mixed Tasks: Resize & Scale
6681 Dry-Run: FALSE
67- Input File: ../mixsync manual v1-2-3.pdf
68- Output File: ../mixsync manual v1-2-3.A0.SCALED.pdf
82+ Input File: ../mixsync_manual_v1-2-3.pdf
83+ Output File: ../mixsync_manual_v1-2-3.A0.SCALED.pdf
84+ Explode PDF: Disabled
6985 Get Page Size: Adaptive Enabled
7086 Method: Grep
87+ Page Range: None (all pages)
7188 Source Width: 842 postscript-points
7289 Source Height: 595 postscript-points
90+ Print Mode: Print ( auto/empty )
91+ Fit To Page: Enabled (default)
7392 Auto Rotate: PageByPage
7493 Flip Detect: Wrong orientation detected!
7594 Inverting Width <-> Height
7695 Run Resizing: A0 ( 3370 x 2384 ) pts
7796 New Width: 3370 postscript-points
7897 New Height: 2384 postscript-points
7998 Scale Factor: 1.05
99+ Scale Percent: +5%
80100 Vert-Align: CENTER
81101 Hor-Align: CENTER
82102 Translation X: -80.24 = -80.24 + 0.00 (offset)
83103 Translation Y: -56.76 = -56.76 + 0.00 (offset)
84- Run Scaling: 5 %
85104 Background: No background (default)
86105 Final Status: File created successfully
106+
87107```
88108#### Resize to A2 and disables Auto-Rotation
89109```
90- $ pdfscale -v -r A2 -a none ../input.pdf
91- pdfscale v2.4.0 - Verbose Execution
110+ $ ./pdfScale.sh -v -r A2 -a none ../input.pdf
111+ pdfScale.sh v2.6.2 - Verbose Execution
92112 Single Task: Resize PDF Paper
93113 Dry-Run: FALSE
94114 Input File: ../input.pdf
95115 Output File: ../input.A2.pdf
116+ Explode PDF: Disabled
96117 Get Page Size: Adaptive Enabled
97118 Method: Grep
119+ Page Range: None (all pages)
98120 Source Width: 595 postscript-points
99121 Source Height: 842 postscript-points
122+ Print Mode: Print ( auto/empty )
100123 Scale Factor: Disabled (resize only)
124+ Fit To Page: Enabled (default)
101125 Auto Rotate: None
102126 Flip Detect: No change needed
103127 Run Resizing: A2 ( 1191 x 1684 ) pts
104128 Final Status: File created successfully
129+
105130```
106131#### Resize to custom 200x300 mm, disable Flip-Detection and Scale by 0.95 (-5%)
107132```
108- $ pdfscale -v -v -r 'custom mm 200 300' -f disable -s 0.95 ../mixsync\ manual\ v1-2-3.pdf
109- 2018-08-09:04:56:39 | pdfscale v2.4.0 - Verbose Execution
110- 2018-08-09:04:56:39 | Mixed Tasks: Resize & Scale
111- 2018-08-09:04:56:39 | Dry-Run: FALSE
112- 2018-08-09:04:56:39 | Input File: ../mixsync manual v1-2-3.pdf
113- 2018-08-09:04:56:39 | Output File: ../mixsync manual v1-2-3.CUSTOM.SCALED.pdf
114- 2018-08-09:04:56:39 | Get Page Size: Adaptive Enabled
115- 2018-08-09:04:56:39 | Method: Grep
116- 2018-08-09:04:56:39 | Source Width: 842 postscript-points
117- 2018-08-09:04:56:39 | Source Height: 595 postscript-points
118- 2018-08-09:04:56:40 | Auto Rotate: PageByPage
119- 2018-08-09:04:56:40 | Flip Detect: Disabled
120- 2018-08-09:04:56:40 | Run Resizing: CUSTOM ( 567 x 850 ) pts
121- 2018-08-09:04:56:40 | New Width: 567 postscript-points
122- 2018-08-09:04:56:40 | New Height: 850 postscript-points
123- 2018-08-09:04:56:40 | Scale Factor: 0.95
124- 2018-08-09:04:56:40 | Vert-Align: CENTER
125- 2018-08-09:04:56:40 | Hor-Align: CENTER
126- 2018-08-09:04:56:40 | Translation X: 14.92 = 14.92 + 0.00 (offset)
127- 2018-08-09:04:56:40 | Translation Y: 22.37 = 22.37 + 0.00 (offset)
128- 2018-08-09:04:56:40 | Run Scaling: -5 %
129- 2018-08-09:04:56:40 | Background: No background (default)
130- 2018-08-09:04:56:40 | Final Status: File created successfully
133+ $ ./pdfScale.sh -v -v -r 'custom mm 200 300' -f disable -s 0.95 ../mixsync_manual_v1-2-3.pdf
134+ 2024-07-17:14:43:15 | pdfScale.sh v2.6.2 - Verbose Execution
135+ 2024-07-17:14:43:15 | Mixed Tasks: Resize & Scale
136+ 2024-07-17:14:43:15 | Dry-Run: FALSE
137+ 2024-07-17:14:43:15 | Input File: ../mixsync_manual_v1-2-3.pdf
138+ 2024-07-17:14:43:15 | Output File: ../mixsync_manual_v1-2-3.CUSTOM.SCALED.pdf
139+ 2024-07-17:14:43:15 | Explode PDF: Disabled
140+ 2024-07-17:14:43:15 | Get Page Size: Adaptive Enabled
141+ 2024-07-17:14:43:15 | Method: Grep
142+ 2024-07-17:14:43:15 | Page Range: None (all pages)
143+ 2024-07-17:14:43:16 | Source Width: 842 postscript-points
144+ 2024-07-17:14:43:16 | Source Height: 595 postscript-points
145+ 2024-07-17:14:43:16 | Print Mode: Print ( auto/empty )
146+ 2024-07-17:14:43:16 | Fit To Page: Enabled (default)
147+ 2024-07-17:14:43:16 | Auto Rotate: PageByPage
148+ 2024-07-17:14:43:16 | Flip Detect: Disabled
149+ 2024-07-17:14:43:16 | Run Resizing: CUSTOM ( 567 x 850 ) pts
150+ 2024-07-17:14:43:16 | New Width: 567 postscript-points
151+ 2024-07-17:14:43:16 | New Height: 850 postscript-points
152+ 2024-07-17:14:43:16 | Scale Factor: 0.95
153+ 2024-07-17:14:43:16 | Scale Percent: -5%
154+ 2024-07-17:14:43:16 | Vert-Align: CENTER
155+ 2024-07-17:14:43:16 | Hor-Align: CENTER
156+ 2024-07-17:14:43:16 | Translation X: 14.92 = 14.92 + 0.00 (offset)
157+ 2024-07-17:14:43:16 | Translation Y: 22.37 = 22.37 + 0.00 (offset)
158+ 2024-07-17:14:43:16 | Background: No background (default)
159+ 2024-07-17:14:43:17 | Final Status: File created successfully
131160
132161```
133162
134163## Help info
135164```
136165$ ./pdfScale.sh -h
137- pdfScale.sh v2.6.1
166+ pdfScale.sh v2.6.2
138167
139168Usage: pdfScale.sh <inFile.pdf>
140169 pdfScale.sh -i <inFile.pdf>
@@ -178,6 +207,9 @@ Parameters:
178207 Prints <file> Paper Size information to screen and exits
179208 -e, --explode
180209 Explode (split) outuput PDF into many files (one per page)
210+ --range, --page-range <page-list>
211+ Defines the page range to be processed, using the -sPageList notation
212+ Read below for more information on valid page ranges
181213 -s, --scale <factor>
182214 Changes the scaling factor or forces mixed mode
183215 Defaults: 0.95 (scale mode) / Disabled (resize mode)
@@ -277,6 +309,20 @@ Mixed Mode:
277309 - In mixed mode both the -s option and -r option must be specified
278310 - The PDF will be first resized then scaled
279311
312+ Page Ranges:
313+ - Please refer to the Ghostscript manual on '-sPageList' for more info and examples.
314+ - May cause execution warnings from Ghostscript if the PDF refences pages that were
315+ removed. The output file should still be created, but with broken internal links.
316+ - Using a range with an inexistant page will raise a warning from Ghostscript and
317+ may also generate blank pages.
318+ - Single page number | ex: --range 2
319+ - Interval | ex: --range 2-4
320+ - List of pages | ex: --range 1,3,6
321+ - From page to end | ex: --range 3-
322+ - odd/even specifier | ex: --range odd
323+ - odd/even range | ex: --range even:1-4
324+ - mixed entries | ex: --range 1,3-5,8-
325+
280326Output filename:
281327 - Having the extension .pdf on the output file name is optional,
282328 it will be added if not present.
@@ -454,7 +500,8 @@ It will try the following methods in sequence:
454500 2 . Failed AND MacOS ? Try ` mdls `
455501 3 . Failed ? Try ` pdfinfo `
456502 4 . Failed ? Try ImageMagick's ` identify `
457- 5 . Failed ? ` Exit ` with error message
503+ 5 . Failed ? Try Ghostscript with a PS script
504+ 6 . Failed ? ` Exit ` with error message
458505
459506The ` grep ` method will fail on PDFs without a ` /MediaBox ` .
460507You may install any of the optionals to be used in that case.
0 commit comments