| @@ -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_DETECTION=$TRUE # If we should run the Flip-detection | ||||
| FLIP_FORCE=$FALSE # If we should force Flipping | FLIP_FORCE=$FALSE # If we should force Flipping | ||||
| AUTO_ROTATION='/PageByPage' # GS call auto-rotation setting | AUTO_ROTATION='/PageByPage' # GS call auto-rotation setting | ||||
| FIT_PAGE='-dPDFFitPage' # GS call resize fit page setting | |||||
| PGWIDTH="" # Input PDF Page Width | PGWIDTH="" # Input PDF Page Width | ||||
| PGHEIGHT="" # Input PDF Page Height | PGHEIGHT="" # Input PDF Page Height | ||||
| RESIZE_WIDTH="" # Resized PDF Page Width | RESIZE_WIDTH="" # Resized PDF Page Width | ||||
| @@ -333,7 +334,7 @@ gsPageResize() { | |||||
| -dSubsetFonts=true -dEmbedAllFonts=true \ | -dSubsetFonts=true -dEmbedAllFonts=true \ | ||||
| -dDEVICEWIDTHPOINTS=$RESIZE_WIDTH -dDEVICEHEIGHTPOINTS=$RESIZE_HEIGHT \ | -dDEVICEWIDTHPOINTS=$RESIZE_WIDTH -dDEVICEHEIGHTPOINTS=$RESIZE_HEIGHT \ | ||||
| -dAutoRotatePages=$AUTO_ROTATION \ | -dAutoRotatePages=$AUTO_ROTATION \ | ||||
| -dFIXEDMEDIA -dPDFFitPage \ | |||||
| -dFIXEDMEDIA $FIT_PAGE \ | |||||
| -sOutputFile="$OUTFILEPDF" \ | -sOutputFile="$OUTFILEPDF" \ | ||||
| -f "$INFILEPDF" | -f "$INFILEPDF" | ||||
| return $? | return $? | ||||
| @@ -354,7 +355,7 @@ gsPrintPageResize() { | |||||
| -dSubsetFonts=true -dEmbedAllFonts=true \ | -dSubsetFonts=true -dEmbedAllFonts=true \ | ||||
| -dDEVICEWIDTHPOINTS=$RESIZE_WIDTH -dDEVICEHEIGHTPOINTS=$RESIZE_HEIGHT \ | -dDEVICEWIDTHPOINTS=$RESIZE_WIDTH -dDEVICEHEIGHTPOINTS=$RESIZE_HEIGHT \ | ||||
| -dAutoRotatePages=$AUTO_ROTATION \ | -dAutoRotatePages=$AUTO_ROTATION \ | ||||
| -dFIXEDMEDIA -dPDFFitPage \ | |||||
| -dFIXEDMEDIA $FIT_PAGE \ | |||||
| -sOutputFile="$OUTFILEPDF" \ | -sOutputFile="$OUTFILEPDF" \ | ||||
| -f "$INFILEPDF" | -f "$INFILEPDF" | ||||
| _EOF_ | _EOF_ | ||||
| @@ -518,6 +519,11 @@ getOptions() { | |||||
| parseAutoRotationMode "$1" | parseAutoRotationMode "$1" | ||||
| shift | shift | ||||
| ;; | ;; | ||||
| --fit-page) | |||||
| shift | |||||
| parseFitPageMode "$1" | |||||
| shift | |||||
| ;; | |||||
| --background-gray) | --background-gray) | ||||
| shift | shift | ||||
| parseGrayBackground $1 | parseGrayBackground $1 | ||||
| @@ -1073,6 +1079,23 @@ parseAutoRotationMode() { | |||||
| esac | 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 | # Validades the a paper resize CLI option and sets the paper to $RESIZE_PAPER_TYPE | ||||
| parsePaperResize() { | parsePaperResize() { | ||||
| isEmpty "$1" && initError 'Invalid Paper Type: (empty)' $EXIT_INVALID_PAPER_SIZE | isEmpty "$1" && initError 'Invalid Paper Type: (empty)' $EXIT_INVALID_PAPER_SIZE | ||||
| @@ -2095,6 +2118,11 @@ Parameters: | |||||
| n, none Retains orientation of each page | n, none Retains orientation of each page | ||||
| a, all Rotates all pages (or none) depending | a, all Rotates all pages (or none) depending | ||||
| on a kind of \"majority decision\" | 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> | --hor-align, --horizontal-alignment <left|center|right> | ||||
| Where to translate the scaled page | Where to translate the scaled page | ||||
| Default: center | Default: center | ||||