ソースを参照

Merge pull request #16 from boillodmanuel/master

PR for #15 - Add option to set/unset `-dPDFFitPage` during resizing to be able to add right margin. Pulling from PR, seems fine. Need to bump version on next commit to 2.4.4
master
Gustavo Arnosti Neves 5年前
committed by GitHub
コミット
9f3171898f
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: 4AEE18F83AFDEB23
2個のファイルの変更35行の追加2行の削除
  1. +5
    -0
      README.md
  2. +30
    -2
      pdfScale.sh

+ 5
- 0
README.md ファイルの表示

@@ -195,6 +195,11 @@ Parameters:
n, none Retains orientation of each page
a, all Rotates all pages (or none) depending
on a kind of "majority decision"
--fit-page <mode>
Use of GS option dPDFFitPage, used by default
This option is only valid in resize mode
Modes: f, fit Fit page
n, no Do not fit page
--hor-align, --horizontal-alignment <left|center|right>
Where to translate the scaled page
Default: center


+ 30
- 2
pdfScale.sh ファイルの表示

@@ -56,6 +56,7 @@ CUSTOM_RESIZE_PAPER=$FALSE # If we are using a custom-defined paper
FLIP_DETECTION=$TRUE # If we should run the Flip-detection
FLIP_FORCE=$FALSE # If we should force Flipping
AUTO_ROTATION='/PageByPage' # GS call auto-rotation setting
FIT_PAGE='-dPDFFitPage' # GS call resize fit page setting
PGWIDTH="" # Input PDF Page Width
PGHEIGHT="" # Input PDF Page Height
RESIZE_WIDTH="" # Resized PDF Page Width
@@ -333,7 +334,7 @@ gsPageResize() {
-dSubsetFonts=true -dEmbedAllFonts=true \
-dDEVICEWIDTHPOINTS=$RESIZE_WIDTH -dDEVICEHEIGHTPOINTS=$RESIZE_HEIGHT \
-dAutoRotatePages=$AUTO_ROTATION \
-dFIXEDMEDIA -dPDFFitPage \
-dFIXEDMEDIA $FIT_PAGE \
-sOutputFile="$OUTFILEPDF" \
-f "$INFILEPDF"
return $?
@@ -354,7 +355,7 @@ gsPrintPageResize() {
-dSubsetFonts=true -dEmbedAllFonts=true \
-dDEVICEWIDTHPOINTS=$RESIZE_WIDTH -dDEVICEHEIGHTPOINTS=$RESIZE_HEIGHT \
-dAutoRotatePages=$AUTO_ROTATION \
-dFIXEDMEDIA -dPDFFitPage \
-dFIXEDMEDIA $FIT_PAGE \
-sOutputFile="$OUTFILEPDF" \
-f "$INFILEPDF"
_EOF_
@@ -518,6 +519,11 @@ getOptions() {
parseAutoRotationMode "$1"
shift
;;
--fit-page)
shift
parseFitPageMode "$1"
shift
;;
--background-gray)
shift
parseGrayBackground $1
@@ -1073,6 +1079,23 @@ parseAutoRotationMode() {
esac
}

# Parses and validates the resize fit page
parseFitPageMode() {
local param="$(lowercase $1)"
case "${param}" in
n|no)
FIT_PAGE=''
;;
f|fit)
FIT_PAGE='-dPDFFitPage'
;;
*)
initError "Invalid Resize Fit Page Mode: \"$1\"" $EXIT_INVALID_OPTION
return $FALSE
;;
esac
}

# Validades the a paper resize CLI option and sets the paper to $RESIZE_PAPER_TYPE
parsePaperResize() {
isEmpty "$1" && initError 'Invalid Paper Type: (empty)' $EXIT_INVALID_PAPER_SIZE
@@ -2095,6 +2118,11 @@ Parameters:
n, none Retains orientation of each page
a, all Rotates all pages (or none) depending
on a kind of \"majority decision\"
--fit-page <mode>
Use of GS option dPDFFitPage, used by default
This option is only valid in resize mode
Modes: f, fit Fit page
n, no Do not fit page
--hor-align, --horizontal-alignment <left|center|right>
Where to translate the scaled page
Default: center


読み込み中…
キャンセル
保存