tavinus / pdfScale

Bash Script to Scale and Resize PDFs using Ghostscript
MIT License
246 stars 37 forks source link

Add an auto scale option #34

Closed tavinus closed 2 years ago

tavinus commented 2 years ago

If -s auto is used, pdfScale.sh will compute the scale itself. This is useful when one wants to print a PDF onto a different media than its indicated media size, while keeping the dimensions of its content the same on the new media. While this can often be achieved simply by printing, some platforms, e.g., Chrome OS, lack the ability to center a PDF when printing it, making double sided printed of centered content (e.g., for cutting a booklet) impossible without transforming the PDF before printing.

In scale mode, the default scale of 0.95 is used.

In mixed mode, the scale will be computed to be the ratio of the input's page size divided by the output's resized page size. The width and height ratios are both computed and the minium of the two is used as the scale. If the resulting scale would be bigger than 1 (100% of the resized page), it is limited to 1.