How to convert image to password protected PDF with command line

If you want to convert image to password protected PDF so that you can prevent unauthorized people to view, copy, edit, print, etc. it, the application Image to PDF OCR Converter will be a good choice for you.

Image to PDF OCR Converter is a simple and professional command line application for converting JPG, PNG, BMP, GIF, TIF, TGA, DCX, EMF, WMF, etc. format image to PDF. What’s more, it supports to encrypt the created PDF with open password to protect PDF from opening and owner password to prevent PDF from editing, copying, printing, etc.

To know how to use this command line tool to convert image to PDF and encrypt the output PDF with open password and owner password, please do as follows:

Firstly, please download the package of Image to PDF OCR Converter. After the download, you can find a ZIP file in the downloaded file list on your computer. Please extract the ZIP file to a folder on the computer disk. In the unzipped folder, you can find an executable file named img2pdfocr.exe which is the called program of this application.

Secondly, please open the MS-DOS command prompt window in which you can input commands

Thirdly, in the opened MS-DOS command prompt window, please input commands to convert image to encrypted PDF by referring to the command line template shown below:

img2pdf [options] <Image-file> [<PDF-file>]

To encrypt the output PDF with open password and owner password, please use the following options:

  • -openpwd <string> : set 'open password' to PDF file
  • -ownerpwd <string> : set 'owner password' to PDF file

What’s more, you can use the following encryption modes at the same time.

  • -encryption 0: encrypt the file only
  • -encryption 3900: deny anything
  • -encryption 4: deny printing
  • -encryption 8: deny modification of contents
  • -encryption 16: deny copying of contents
  • -encryption 32: no commenting

===128 bit encryption only -> ignored if 40 bit encryption is used

  • -encryption 256: deny FillInFormFields
  • -encryption 512: deny ExtractObj
  • -encryption 1024: deny Assemble
  • -encryption 2048: disable high res. printing
  • -encryption 4096: do not encrypt metadata

For example,

D:\img2pdfocr\img2pdfocr.exe -ownerpwd 123 E:\secret.jpg C:\ secret.pdf

This example is to convert a secret.jpg image to secret.pdf and encrypt the PDF with owner password “123”.

Lastly, please press the Enter button on your keyboard to run the commands.

Several seconds later, you can get the password protected PDF in the specified location.

This is the end of this article and you can get Image to PDF OCR Converter here.

Related Posts: