1
1
# pdfScale 2
2
2
Bash Script to *** scale*** and/or *** resize*** PDFs from the command line.
3
3
Uses ghostscript (` gs ` ) to create a scaled and/or resized version of the pdf input.
4
-
4
+
5
5
In ` scaling mode ` , the PDF paper size does not change, just the elements are scaled.
6
6
In ` resize mode ` , the PDF paper will be changed and fit-to-page will be applied.
7
7
In ` mixed mode ` , the PDF will first be ` resized ` then ` scaled ` with two Ghostscript calls.
@@ -108,8 +108,8 @@ $ pdfscale -v -v -r 'custom mm 200 300' -f disable -s 0.95 ../mixsync\ manual\ v
108
108
109
109
## Help info
110
110
```
111
- $ pdfscale -h
112
- pdfscale v2.1.2
111
+ $ pdfscale --help
112
+ pdfscale v2.2.0
113
113
114
114
Usage: pdfscale <inFile.pdf>
115
115
pdfscale -i <inFile.pdf>
@@ -123,15 +123,15 @@ Parameters:
123
123
-v, --verbose
124
124
Verbose mode, prints extra information
125
125
Use twice for timestamp
126
- -h, --help
126
+ -h, --help
127
127
Print this help to screen and exits
128
128
-V, --version
129
129
Prints version to screen and exits
130
130
-n, --no-overwrite
131
131
Aborts execution if the output PDF file already exists
132
132
By default, the output file will be overwritten
133
133
-m, --mode <mode>
134
- Paper size detection mode
134
+ Paper size detection mode
135
135
Modes: a, adaptive Default mode, tries all the methods below
136
136
g, grep Forces the use of Grep method
137
137
m, mdls Forces the use of MacOS Quartz mdls
@@ -153,14 +153,41 @@ Parameters:
153
153
Inverts Width <-> Height of a Resized PDF
154
154
Modes: a, auto Keeps source orientation, default
155
155
f, force Forces flip W <-> H
156
- d, disable Disables flipping
156
+ d, disable Disables flipping
157
157
-a, --auto-rotate <mode>
158
158
Setting for GS -dAutoRotatePages, defaults to 'PageByPage'
159
159
Uses text-orientation detection to set Portrait/Landscape
160
160
Modes: p, pagebypage Auto-rotates pages individually
161
161
n, none Retains orientation of each page
162
162
a, all Rotates all pages (or none) depending
163
163
on a kind of "majority decision"
164
+ --hor-align,--horizontal-alignment <left|center|right>
165
+ Where to translate the scaled page
166
+ Default: center
167
+ Options: left, right, center
168
+ --vert-align,--vertical-alignment <top|center|bottom>
169
+ Where to translate the scaled page
170
+ Default: center
171
+ Options: top, bootom, center
172
+ --xoffset,--xtrans-offset <FloatNumber>
173
+ Add/Subtract from the X translation (move left-right)
174
+ Default: 0.0 (zero)
175
+ Options: Positive or negative floating point number
176
+ --yoffset,--ytrans-offset <FloatNumber>
177
+ Add/Subtract from the Y translation (move top-bottim)
178
+ Default: 0.0 (zero)
179
+ Options: Positive or negative floating point number
180
+ --pdf-settings <gs-pdf-profile>
181
+ Ghostscript PDF Profile to use in -dPDFSETTINGS
182
+ Default: printer
183
+ Options: screen, ebook, printer, prepress, default
184
+ --image-downsample <gs-downsample-method>
185
+ Ghostscript Image Downsample Method
186
+ Default: bicubic
187
+ Options: subsample, average, bicubic
188
+ --image-resolution <dpi>
189
+ Resolution in DPI of color and grayscale images in output
190
+ Default: 300
164
191
-p, --print-papers
165
192
Prints Standard Paper info tables to screen and exits
166
193
@@ -169,7 +196,9 @@ Scaling Mode:
169
196
size and scaling pre-set to 0.95
170
197
- By not using the resize mode you are using scaling mode
171
198
- Flip-Detection and Auto-Rotation are disabled in Scaling mode,
172
- you can use '-r source -s <scale>' to override.
199
+ you can use '-r source -s <scale>' to override.
200
+ - Ghostscript placement is from bottom-left position. This means that
201
+ a bottom-left placement has ZERO for both X and Y translations.
173
202
174
203
Resize Paper Mode:
175
204
- Disables the default scaling factor! (0.95)
@@ -190,22 +219,22 @@ Output filename:
190
219
.<PAPERSIZE>.SCALED.pdf is added in mixed mode
191
220
192
221
Standard Paper Names: (case-insensitive)
193
- A0 A1 A2 A3 A4
194
- A4SMALL A5 A6 A7 A8
195
- A9 A10 ISOB0 ISOB1 ISOB2
196
- ISOB3 ISOB4 ISOB5 ISOB6 C0
197
- C1 C2 C3 C4 C5
198
- C6 11X17 LEDGER LEGAL LETTER
199
- LETTERSMALL ARCHE ARCHD ARCHC ARCHB
200
- ARCHA JISB0 JISB1 JISB2 JISB3
201
- JISB4 JISB5 JISB6 FLSA FLSE
202
- HALFLETTER HAGAKI
222
+ A0 A1 A2 A3 A4
223
+ A4SMALL A5 A6 A7 A8
224
+ A9 A10 ISOB0 ISOB1 ISOB2
225
+ ISOB3 ISOB4 ISOB5 ISOB6 C0
226
+ C1 C2 C3 C4 C5
227
+ C6 11X17 LEDGER LEGAL LETTER
228
+ LETTERSMALL ARCHE ARCHD ARCHC ARCHB
229
+ ARCHA JISB0 JISB1 JISB2 JISB3
230
+ JISB4 JISB5 JISB6 FLSA FLSE
231
+ HALFLETTER HAGAKI
203
232
204
233
Custom Paper Size:
205
234
- Paper size can be set manually in Milimeters, Inches or Points
206
235
- Custom paper definition MUST be quoted into a single parameter
207
236
- Actual size is applied in points (mms and inches are transformed)
208
- - Measurements: mm, mms, milimeters
237
+ - Measurements: mm, mms, milimeters
209
238
pt, pts, points
210
239
in, inch, inches
211
240
Use: pdfscale -r 'custom <measurement> <width> <height>'
@@ -353,13 +382,13 @@ It will try the following methods in sequence:
353
382
3 . Failed ? Try ` pdfinfo `
354
383
4 . Failed ? Try ImageMagick's ` identify `
355
384
5 . Failed ? ` Exit ` with error message
356
-
385
+
357
386
The ` grep ` method will fail on PDFs without a ` /MediaBox ` .
358
387
You may install any of the optionals to be used in that case.
359
-
388
+
360
389
MacOS is fine using ` mdls ` if the metadata of the file is accurate.
361
390
The metadata is generated automatically by the OS (Spotlight)
362
-
391
+
363
392
##### apt-get
364
393
```
365
394
sudo apt-get install imagemagick pdfinfo
@@ -382,7 +411,7 @@ cd ./pdfScale
382
411
383
412
## System Install
384
413
The installer will name the executable as ` pdfscale ` with no uppercase chars and without the ` .sh ` extension.
385
-
414
+
386
415
If you have ` make ` installed you can use it to install to ` /usr/local/bin/pdfscale ` with:
387
416
```
388
417
sudo make install
0 commit comments