How to crop PDF margins by command line?

     In last article, we talked about how to crop PDF by GUI version software of VeryDOC PDF Margin Crop. In the following part, I will show you how to crop PDF by its command line version. This software either can be used as GUI version software or command line version. And by the command line version, you can call it from Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc. Please check more information on software homepage and in the following part, I will show you how to use the command line software.

Step 1. Install PDF Margin Crop

  • This software is Window application and it is bundled together with GUI version and command line version. When downloading finishes, there will be an exe file. You need to install this software by double clicking the exe file and following installation message. When installation finishes, there will be icon on desktop. Meanwhile in the installation folder you can find the command line executable file.
  • Or you can click Start then go to installation folder, where you can find command line short cut icon.

Step 2. Crop PDF through command line operation.

  • When you use this software, please refer to the usage and command line parameters.
  • Usage:      pdfmc [options] <pdf-file> [<out-pdf>]
  • When you need to crop PDF, please refer to the following command line templates.
    pdfmc.exe C:\in.pdf C:\out.pdf
    When cropping PDF, if you do not add any parameters, this software will crop PDF according to content automatically.
    pdfmc.exe C:\in\*.pdf C:\out\*.pdf
    By wild character, we can crop PDF in batch.
    pdfmc.exe -linewidth 8 C:\in.pdf C:\out.pdf
    By this command line, we can crop PDF and remove black borders which width less than this value 8.
    pdfmc.exe -linewidth 8 -specklesize 20 C:\in.pdf C:\out.pdf
    By this command line, we can crop PDF and remove the speckles which size less than this value.
    pdfmc.exe -linewidth 0 -specklesize 0 C:\in.pdf C:\out.pdf
    By this kind value 0, we can crop PDF and remove all the lines and speckles.
    for %F in (D:\test\*.pdf) do "pdfmc.exe" "%F" "%~dpnF-out.pdf"
    for /r D:\test %F in (*.pdf) do "pdfmc.exe" "%F" "%~dpnF-out.pdf"
    By above command line, we can crop PDF in batch or write bat files.

Now let us check related parameters:

  -skip                : don't overwrite an output file if it already exists
  -margin <string>     : Set page margins to output PDF file
        -margin 10            : Set margin to 10 pt to left
        -margin 10x10         : Set margin to 10 pt to left,top
        -margin 10x10x10      : Set margin to 10 pt to left,top,right
        -margin 10x10x10x10   : Set margin to 10 pt to left,top,right,bottom
        -margin 10pt          : Set margin to 10 pt to left
        -margin 10x10pt       : Set margin to 10 pt to left,top
        -margin 10x10x10pt    : Set margin to 10 pt to left,top,right
        -margin 10x10x10x10pt : Set margin to 10 pt to left,top,right,bottom
        -margin 10mm          : Set margin to 10 mm to left
        -margin 10x10mm       : Set margin to 10 mm to left,top
        -margin 10x10x10mm    : Set margin to 10 mm to left,top,right
        -margin 10x10x10x10mm : Set margin to 10 mm to left,top,right,bottom
        -margin 10in          : Set margin to 10 inch to left
        -margin 10x10in       : Set margin to 10 inch to left,top
        -margin 10x10x10in    : Set margin to 10 inch to left,top,right
        -margin 10x10x10x10in : Set margin to 10 inch to left,top,right,bottom
  -tempdir <string>  : set a folder to store temporary files
  -linewidth <int>     : remove black borders which width less than this value,default is 8
  -specklesize <int>  : remove the speckles which size less than this value, default is 20

By this software, we can crop PDF easily. During the using, if you have any question, please contact us as soon as possible.

VN:F [1.9.20_1166]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.20_1166]
Rating: +1 (from 1 vote)
How to crop PDF margins by command line?, 10.0 out of 10 based on 1 rating

Related Posts

This entry was posted in PDF Margin Crop and tagged , . Bookmark the permalink.

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!