Skip to content

Commit a1881ab

Browse files
committed
v2.2.0 - Added many new options. --pdf-settings, --image-downsample, --image-resolution, --horizontal-alignment, --vertical-alignment, --xtrans-offset, --ytras-offset and also a few tweaks to readme and helpinfo. Help seems a bit slow though. This version address a few of the open issues on github.
1 parent f69b651 commit a1881ab

File tree

2 files changed

+271
-36
lines changed

2 files changed

+271
-36
lines changed

README.md

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# pdfScale 2
22
Bash Script to ***scale*** and/or ***resize*** PDFs from the command line.
33
Uses ghostscript (`gs`) to create a scaled and/or resized version of the pdf input.
4-
4+
55
In `scaling mode`, the PDF paper size does not change, just the elements are scaled.
66
In `resize mode`, the PDF paper will be changed and fit-to-page will be applied.
77
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
108108

109109
## Help info
110110
```
111-
$ pdfscale -h
112-
pdfscale v2.1.2
111+
$ pdfscale --help
112+
pdfscale v2.2.0
113113
114114
Usage: pdfscale <inFile.pdf>
115115
pdfscale -i <inFile.pdf>
@@ -123,15 +123,15 @@ Parameters:
123123
-v, --verbose
124124
Verbose mode, prints extra information
125125
Use twice for timestamp
126-
-h, --help
126+
-h, --help
127127
Print this help to screen and exits
128128
-V, --version
129129
Prints version to screen and exits
130130
-n, --no-overwrite
131131
Aborts execution if the output PDF file already exists
132132
By default, the output file will be overwritten
133133
-m, --mode <mode>
134-
Paper size detection mode
134+
Paper size detection mode
135135
Modes: a, adaptive Default mode, tries all the methods below
136136
g, grep Forces the use of Grep method
137137
m, mdls Forces the use of MacOS Quartz mdls
@@ -153,14 +153,41 @@ Parameters:
153153
Inverts Width <-> Height of a Resized PDF
154154
Modes: a, auto Keeps source orientation, default
155155
f, force Forces flip W <-> H
156-
d, disable Disables flipping
156+
d, disable Disables flipping
157157
-a, --auto-rotate <mode>
158158
Setting for GS -dAutoRotatePages, defaults to 'PageByPage'
159159
Uses text-orientation detection to set Portrait/Landscape
160160
Modes: p, pagebypage Auto-rotates pages individually
161161
n, none Retains orientation of each page
162162
a, all Rotates all pages (or none) depending
163163
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
164191
-p, --print-papers
165192
Prints Standard Paper info tables to screen and exits
166193
@@ -169,7 +196,9 @@ Scaling Mode:
169196
size and scaling pre-set to 0.95
170197
- By not using the resize mode you are using scaling mode
171198
- 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.
173202
174203
Resize Paper Mode:
175204
- Disables the default scaling factor! (0.95)
@@ -190,22 +219,22 @@ Output filename:
190219
.<PAPERSIZE>.SCALED.pdf is added in mixed mode
191220
192221
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
203232
204233
Custom Paper Size:
205234
- Paper size can be set manually in Milimeters, Inches or Points
206235
- Custom paper definition MUST be quoted into a single parameter
207236
- Actual size is applied in points (mms and inches are transformed)
208-
- Measurements: mm, mms, milimeters
237+
- Measurements: mm, mms, milimeters
209238
pt, pts, points
210239
in, inch, inches
211240
Use: pdfscale -r 'custom <measurement> <width> <height>'
@@ -353,13 +382,13 @@ It will try the following methods in sequence:
353382
3. Failed ? Try `pdfinfo`
354383
4. Failed ? Try ImageMagick's `identify`
355384
5. Failed ? `Exit` with error message
356-
385+
357386
The `grep` method will fail on PDFs without a `/MediaBox`.
358387
You may install any of the optionals to be used in that case.
359-
388+
360389
MacOS is fine using `mdls` if the metadata of the file is accurate.
361390
The metadata is generated automatically by the OS (Spotlight)
362-
391+
363392
##### apt-get
364393
```
365394
sudo apt-get install imagemagick pdfinfo
@@ -382,7 +411,7 @@ cd ./pdfScale
382411

383412
## System Install
384413
The installer will name the executable as `pdfscale` with no uppercase chars and without the `.sh` extension.
385-
414+
386415
If you have `make` installed you can use it to install to `/usr/local/bin/pdfscale` with:
387416
```
388417
sudo make install

0 commit comments

Comments
 (0)