From e3350a7c5d31967d15ee8ad5cecb9a9029337836 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 9 Apr 2024 15:37:57 +0200 Subject: modernize: use fenced code blocks --- USE.md | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/USE.md b/USE.md index 3e4cb3f..7b179ac 100644 --- a/USE.md +++ b/USE.md @@ -9,7 +9,9 @@ e.g. using "direct print" from a USB dongle on a Brother HL-4040CN Laser printer. A workaround is to [downgrade](#Downgrade) to PDF 1.2 like this: - ps2pdf12 infile outfile +```shell +ps2pdf12 infile outfile +``` ## Unsupported PDF data @@ -21,11 +23,15 @@ e.g. using "direct print" from a USB dongle on a Brother HL-4040CN Laser printer. A workaround is to [refry](#Refry) like this: - pdf2ps infile - | ps2pdf12 - outfile +```shell +pdf2ps infile - | ps2pdf12 - outfile +``` or using this custom wrapper, where available: - localpdf2ps2pdf infile +```shell +localpdf2ps2pdf infile +``` If the above fails to work, then try replace `pdf2ps` @@ -80,12 +86,16 @@ is technically a page with a /MediaBox of approx. [595 x 842 pt][page_dimensions Resolve all boxes (computing from defaults any omitted ones): - pdfinfo -box -l -1 input.pdf +```shell +pdfinfo -box -l -1 input.pdf +``` Extract MediaBox: - gs -dQUIET -dNODISPLAY -dNOSAFER -sFileName=input.pdf \ - -c "FileName (r) file runpdfbegin 1 1 pdfpagecount {pdfgetpage /MediaBox get {=print ( ) print} forall (\n) print} for quit" +```shell +gs -dQUIET -dNODISPLAY -dNOSAFER -sFileName=input.pdf \ +-c "FileName (r) file runpdfbegin 1 1 pdfpagecount {pdfgetpage /MediaBox get {=print ( ) print} forall (\n) print} for quit" +``` To check if other boxes exist, replace `/MediaBox` with e.g. `/CropBox` in above command, @@ -100,7 +110,9 @@ TODO: Add section on cropping, based on &1 | grep %%BoundingBox +```shell +gs -q -dBATCH -dNOPAUSE -sDEVICE=bbox -dLastPage=1 input.pdf 2>&1 | grep %%BoundingBox +``` Source: @@ -137,7 +149,9 @@ While the main purpose of plakativ is to not only resize but also slice onto multiple smaller tiles, one of its features is easy scaling by area. - plakativ --factor=0.5 --size=250mmx337mm --output=output.pdf input.pdf +```shell +plakativ --factor=0.5 --size=250mmx337mm --output=output.pdf input.pdf +``` ### using Ghostscript with fitPage @@ -154,7 +168,9 @@ Example command, resizing from A3+ to A4 (source width 910.24 and height 1258.9 as reported by `pdfinfo`): - gs -o output.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=643.60333 -dDEVICEHEIGHTPOINTS=890.131 -dFIXEDMEDIA -dFitPage -dCompatibilityLevel=1.4 input.pdf +```shell +gs -o output.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=643.60333 -dDEVICEHEIGHTPOINTS=890.131 -dFIXEDMEDIA -dFitPage -dCompatibilityLevel=1.4 input.pdf +``` TODO: maybe options `-dDEVICEWIDTHPOINTS` and `-dDEVICEHEIGHTPOINTS` can be shortened as `-dDEVICEWIDTH` and `-dDEVICEHEIGHT` @@ -169,8 +185,10 @@ Example command, resizing from A4 to printable-area-A4 (i.e. a dumb printer always auto-resizing to fit): - gs -o output.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dFIXEDMEDIA -dCompatibilityLevel=1.4 \ - -f input.pdf -c "<> setpagedevice" +```shell +gs -o output.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dFIXEDMEDIA -dCompatibilityLevel=1.4 \ +-f input.pdf -c "<> setpagedevice" +``` NB! It is important to list option `-f` before `-c`, to ensure that any `CropBox` marks in file is [overridden] by the command. -- cgit v1.2.3