Edit pdf page size using command line

You do remember that the VeryPDF.com has shown you how to set page magnification, adjust the pages magnification to certain size in terms of comfortable reading, convenient view and something else. But you surely encounter with the problem that you just adjust the content within a page, you could not edit the page size in itself.  Based on this, the VeryPDF.com will explain you how to edit pdf page size using Advanced PDF Tools Command Line.

Step one You can freely download Advanced PDF Tools through https://www.verypdf.com/pdfinfoeditor/advanced_pdf_tools_cmd.zip

do remember extracting it after download is completed, for it is zipped package.

Now, open the containing folder, you will see

Snap176

Step two launch the  MS-DOS command prompt window, because the command line is bound to run under MS-DOS environment, launching MS-DOS command prompt window is essential and crucial, here goes the procedure

press  “start”>choose “Run”>input “cmd”>press “ok”

so you will see the  MS-DOS command prompt window.

Snap177

Step three input command line to set pdf file page size, it is

pdftools -i "C:\input.pdf" -o "C:\output.pdf" -x "llx lly urx ury"    

where the parameter "llx lly urx ury" is a form of rectangles, which is described in remark one.

Remark One: Rectangle Description
Rectangles are used to describe locations on a page and bounding boxes for a variety of objects, such as fonts. A rectangle is written as an array of four numbers giving the coordinates of a pair of diagonally opposite corners. Typically, the array takes the form [llx lly urx ury] specifying the lower-left x, lower-left y, upper-right x, and upper-right y coordinates of the rectangle, in that order. The other two corners of the rectangle are
then assumed to have coordinates (llx, ury) and (urx, lly).

so you can input four numbers to substitute "llx lly urx ury" to set page size according your requirements, such as 0 0 800 900, therefore the command to set page size can be written as 

pdftools -i "C:\input.pdf" -o "C:\output.pdf" -x "0 0 800 900"    

when the input is finished, press “enter” and then  you will see

Snap180

this window tells you your operation goes smoothly.

Step four open the file to see how the page size changed

Snap181

Additionally, you can take the following as reference to edit pdf page to meet various requirements

Remark Two: Usually there are three size unit such as point (pt), inch (in), millimeter (mm). Point size can be converted to inch like point/72=inch, and point to millimeter like point/72*25.4=millimeter. For example, the 595.5pt can be 8.27in or 210.06mm by calculating as:

595.5/72=8.27
595.5/72*25.4=210.06
Remark Three: if urx (Width) or ury (Height) equal zero, the value of urx (Width) or ury (Height)  will be calculated automatically, maintain their original aspect ratio,
eg.
pdftools.exe -i C:\in.pdf -o C:\out.pdf -x "0 0 612 792" -j "612 792 true"
pdftools.exe -i C:\in.pdf -o C:\out.pdf -x "0 0 612 0" -j "612 0 true"       //ury (Height) will be calculated automatically
pdftools.exe -i C:\in.pdf -o C:\out.pdf -x "0 0 0 792" -j "0 792 true"       //urx (Width) will be calculated automatically

If you have any questions, please don not hesitate to leave your comment below.

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!