6/26/2023 0 Comments Print to scale pdf![]() ![]() Oh and, the “\” line ends in the command above are just for line continuation in bash. Now you know how to calculate these numbers for other scales and page sizes … So a DIN A4 page is 595×842 pps (width×height) in Ghostscript, and 5% of this is the 29.75×42.1 pps you see in the command. The 5% has to be expressed in absolute measures of the DIN A4 page we’re using here, using PostScript points as units (which are 1/72 inches). This example scales the page content to 90%, and to compensate, moves it right and up by 5% each to keep its center the same. dSubsetFonts=true -dEmbedAllFonts=true \ dCompatibilityLevel="1.3" -dPDFSETTINGS="/printer" \ q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dSAFER \ The core Ghostscript command used in all of the above scripts is this: gs The same instruction should also work with Postscript (PS) files. It is quite elegant, includes freely adjustable margins, vector fonts and images, and avoids the GUI hassles. ![]() Nice little demo of the power of open source collaboration ? Cole’s version and extending it in the tavinus pdfScale Github repository and working on it a lot, creating an elaborate solution. Gustavo Arnosti Neves, using Michael J.Cole, again improving the script over the previous version and providing it in this Github gist (also, see his comment below and hist StackOverflow answer). user2697605, improving the script further in this StackOverflow answer.Håkon Hægland, improving the script further in this StackOverflow answer.Walt, improving the script in the comments below.crooney, extending it into a script in the comments below.Thomas, getting it to work in the first comment below.Myself, providing it as an incomplete solution in this post.Helge Blischke, adding to it in this message.ReproRog, in this message from December 2007.Here’s that history, to give credit where credit is due: Haven’t seen something like this yet: software emerging “by itself” from a non-working 7 lines of code to an elaborate command-line utility over the course of 10 years. The history behind that piece of software is really funny, actually. It is very elaborate, including both functions for scaling the content, for resizing the page, and for both. For the latest and most comfortable implementation, use the tavinus pdfScale software. Since Thomas enabled this to work (see comments), this is the single best-working alternative in this list. Let’s start: Alternative 1: pdfScale.sh, using ghostscript (works best!) There are multiple solution alternatives, but only the first is reported to work out well. This article is about solutions that work on Linux, though some might also work on Windows and Mac. That is, how to change the margins of PDF files while keeping the physical page size the same.
0 Comments
Leave a Reply. |