Resize PDF Files

I have many (about 1000) multi-page PDF files for the program I am writing.

The problem is that many of them do not fit the page size, even in the same document. Does anyone know how I could programmatically view files and resize pages to what I want? It can be in any language.

I can accomplish this in Adobe Acrobat Pro, but there are so many that it ultimately takes a lot of time. The only way I can resize is to add the background from the file and then select the file I want to resize.

+4
source share
3 answers

PDFtk is generally suitable for such problems. This will allow you to parse all the details and reorder / resize / resize pages on the command line.

+1
source

I had a similar problem, and I could easily solve it with PDF split and merge - a tool for editing PDF files based on Java.

0
source

You can resize the PDF file using the Ghostscript command-line tool.

Assuming you want to resize the PDF to 306x396 points (which will give you a quarter of pages in letter size), follow these steps:

 gs \ -o 306x396-points.pdf \ -sDEVICE=pdfwrite \ -g3060x3960 \ -dPDFFitPage \ -dUseCropBox \ input.pdf 

Note that the sizes -g.... are in pixels. Since Ghostscript internally computes with 720 PPI by default, they increase 10 times the size in points .

For Windows, use gswin32c.exe or gswin64c.exe instead of gs .

0
source

Source: https://habr.com/ru/post/1488167/


All Articles