Set permissions of a pdf file using command line

A pdf owner password is the password used to set document restrictions in pdf files. As of the latest PDF version, document restrictions include printing, changing the document, document assembly, content copying, content copying for accessibility, page extraction, commenting, filling of form fields, signing, and creation of template pages. In Adobe Acrobat, the pdf owner password is called the change permissions password.  Therefore, setting an owner password allows you to protect your copyrights while if you do not deny anything, for instance, you entitle people viewing your pdf file to have the right to print or modify the content and etc., and you should set corresponding permissions. The related command lines are as follows:

     -S "-permission=0"  : Deny anything
    -S "-permission=1"  : Allowed print the document
    -S "-permission=2"  : Allowed modify the content of the document
    -S "-permission=4"  : Allowed copy text and graphics from the document
    -S "-permission=8"  : Allowed add or modify annotations
    -S "-permission=16" : Allowed fill in interactive form fields
    -S "-permission=32" : Allowed extract text and graphics from the document
    -S "-permission=64" : Allowed assemble the document
    -S "-permission=128": Allowed print the document with high resolution

Based on this, you can set corresponding permissions when encrypting owner password, to the effect, you want to set permission of printing the document, the command line is

pdftools.exe -i C:\*.pdf -o D:\*.pdf -S ownerpwd=123 -S keylen=2 -S permission=1

below is detailed operation

First, follow this link you will obtain Advanced PDF Tools

http://www.verypdf.com/pdfinfoeditor/advanced_pdf_tools_cmd.zip.

do remember to extract it, for it is a zipped package.

Second, launch the MS-DOS command prompt window

steps are as follows:

start the dialog box of “cmd.exe”: press  “start”>choose “Run”>input “cmd”>press “ok”

way to launch MS-DOS command prompt window

when the following appears, you will have the MS-DOS command prompt window

command prompt

Third, input the command line to set permissions of a pdf file

it goes below

pdftools.exe -i C:\*.pdf -o D:\*.pdf -S ownerpwd=123 -S keylen=2 -S permission=1

where

  • the option -i is to specify a pdf filename or a directory for input,
  • the option -o is to specify the pdf file name for output,
  • -S ownerpwd=123 to set owner password as 123,
  • -S keylen=2 refers to 128 bit AES encryption (Acrobat 7 or higher),
  • -S permission=1--- allowed print the document.

when the input is done, press “enter” key, you will see

detailed command line inputting

Fourth, open the file to check the effect

result picture

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

This entry was posted in Advanced PDF Tools 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!