Menu Close

Command Line Software for PDF Conversion

2PDF is a command line utility for converting popular office documents and images to the PDF format. Besides file conversion in batch mode, it offers various options and parameters to convert your files the best way. Based on the command line interface, it can work regularly or nonstop 24/7.

2PDF allows conversion of entire folders (including subfolders) and archives with files. You can also select specific pages, delete source files, sort output files, handle attachments, and make conversion silent without any alerts.

2PDF compatibility

2PDF can work with: 

  • Command-line application (cmd.exe, PowerShell)
  • Windows Task Scheduler
  • BAT (batch) file or VB script
  • paths to files listed in a .txt file
  • your own software or existing source code

Supported Formats

2PDF supports a wide variety of 100+ types of documents and images (over 275 file extensions) as input files.

See all supported filetypes→

Batch convert to PDF from Command Line

Simple Command Line Syntax

Set up automated folder-to-folder file conversion using simple command line syntax. The basic command starting with 2PDF.exe should be typed after opening the command-line application. You can use 2PDF with Command Prompt, Windows PowerShell, Windows Terminal or any similar command line interface.

Features Overview

Primary features

Merge various files into multipage PDF files 

Using the -pdf switch, you can split and merge files into a multipage PDF. This way, you can create large documents by adding more pages to an existing PDF. 2PDF lets you combine files in different ways: append (add to the end), prepend (add to the beginning), keep files "as is" and split them.


2PDF.exe -src "C:\In\*.*" -dst "C:\Out" -pdf multipage:append combine:"my multipage.pdf"

Split multipage documents into pages or page ranges

If you set -pdf multipage:split in the command line, 2PDF would split documents into single pages. However, you can also split into separate files with a specified number of pages – via the -pdf split_step parameter. For example, file one: pages 1, 2, 3, file two: pages 4, 5, 6, file three: 7, 8, 9, and so on.


2PDF.exe -src "C:\In\*.*" -dst "C:\Out" -pdf multipage:split split_step:3

Read more about merging files to PDF

Rotate and auto-rotate PDF pages

Special parameters -oper autorotate and -oper rotate let you automatically or manually rotate pages within output PDFs. You can select page range, page orientation (portrait/landscape), rotation direction (clockwise or counterclockwise), and background color. 

Besides, you can set rotation or autorotation as a default setting for all files – by adding a Rotate or Auto rotate operation in 2PDF Settings (2pdf.exe -ini).


2PDF.exe -src "C:\In\*.*" -dst "C:\Out" -oper autorotate orientation:portrait direction:ccw

Watermark images and documents

Add watermark to each document page or specific pages using -oper watermark or -oper textwatermark switches. You can set font and font-related options, text size (for text watermark), alignment, color, blending method, rotation, and more. Three types of watermark are available: Image watermark, Text watermark, Barcode watermark.

Add a clickable URL to text or image watermark

You can add any web link (URL) to any watermark created by 2PDF. As a result, the watermark will be clickable in the output PDF file and will open the web page you specified. You can do it with the url parameter, for example, -oper textwatermark url: This works both for text and image watermark.


2PDF.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png"

2PDF.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"Confidential"

Compress PDF file when converting Word files

Forget about an issue when a PDF is larger than the original Word document! Using 2PDF as a PDF compressor, you can save files to minimum size and reduce the size of output PDFs. This min_size feature works when converting DOC and DOCX files only. It can make the file size smaller approximately by 30-40% (depending on the document contents) without much loss in quality. 


2PDF.exe -src "C:\In\*.*" -dst "C:\Out" -pdf min_size:yes

Create searchable PDF files with OCR

If you have raster (bitmap) images or document scans such as TIFF, PNG, JPEG, you can use 2PDF to recognize text. This way, you can create searchable PDF files. Built-in OCR component can be enabled by the parameter -pdf ocr. Different languages are available: English, French, German, Hebrew, Japanese, Russian, Spanish. Choose only those languages that are present in your input files. 

Please note that if your source files already contain text that can be selected, copied, etc., enabling the OCR feature is not needed. The original text will be preserved in the output PDF files by default.


2PDF.exe -src "C:\In\*.*" -dst "C:\Out" ocr:yes ocr_lang:German

Batch Protect & Unlock Password- Protected PDF

2PDF can handle many password-protected files in bulk. Using the dstpwd parameter, you can make output files secured with a single password. 

If you have a bunch of password-protected PDF files and you want to remove the password from them, you can use srcpwd to unlock these secured PDF files. In the latter case, it is possible to unencrypt files with several passwords.


2PDF.exe -src "C:\In\*.*" -dst "C:\Out" -options dstpwd:123456

Add a rectangular frame to output PDF pages

Add a rectangular frame to output PDF pages

Using the -oper paint switch, you can add a rectangular frame to output PDF pages. Or, add a solid rectangle with or without a border. Both can be configured according to your needs. You can set: page range, "fill" or "draw" coloring mode, width and height, brush and pen color, thickness of the frame, background or foreground position, and more.


2PDF.exe -src "C:\In\*.*" -dst "C:\Out" -oper paint cmd:drawrect rect:"150 200 500 500" pen_color:"r:0,g:0,b:0,a:255" brush_color:"r:0,g:0,b:0,a:0" pen_width:4

Move, copy, or delete files automatically after conversion

Move, copy, or delete files automatically after conversion

Want to move, copy, or delete the source files after conversion? 2PDF has the -postproc switch for this job. It will automatically copy or move the original source files to a specified folder or delete them when the batch conversion session is complete.

This feature can be enabled both from the 2PDF Settings or command line syntax.


2PDF.exe -src "C:\In\*.*" -dst "C:\Out" -postproc passed:copy passed_dir:"C:\Done"

Add QR codes or barcodes to PDF

Add QR codes or barcodes to PDF

2PDF can automatically add a user-specified Barcode watermark to all or selected output PDF pages. Add QR Code, Code 128, Code 39, UPC-A, and other barcode types. For each barcode, you can adjust size, position, alignment, offset, page range, and other parameters. You can either enter values from a barcode generator or, for example, type any text that you wish to create a QR-code from.

This feature can be accessed from 2PDF Settings (2pdf.exe -ini) > Edit operations > Barcode watermark.

Configure default settings with GUI controls

Configure default settings with GUI controls

With the 2PDF Settings control panel, you can easily change the default settings of the program. This panel allows you to set up everything only once – so you won't need to add many switches & parameters to the command line every time.

To access 2PDF Settings, run the command:

2PDF.exe -ini

What else you can do with 2PDF

Save any web page as PDF

2PDF can convert not only files, but web pages, too. To create a PDF from any web page (https://…), you just need to enter the URL address to be used as a source when setting the source switch.

Control processing of attachments

You can set the way of processing file attachments: place attachments before or after the main document, save the main document and its attachments as separate files or, for example, ignore attachments.

Keep PDF bookmarks

Using the keep_bookmarks parameter, you can enable/disable keeping bookmarks of source files after conversion. By default, the bookmarks will remain the same as in the source files.

Use source file names as PDF bookmarks

You can optionally use source file names as PDF bookmarks so that you can navigate to different sections named as source files inside the merged PDF. To do it, find the New file bookmarks title template in 2PDF Settings and set it to {srcfilename}.{srcfileext}.

Convert Word, Outlook, and Excel files without Microsoft Office installed

Though some file types require additional software, 2PDF can convert most of them on its own. For example, it can handle popular Office documents using the internal engine only: Excel XLS, XLSX files, Word DOC, DOCX, RTF files, Outlook MSG, EML files.


How to convert files using the default settings?

  1. Download and install 2PDF
  2. Use Win+R hotkey or click Start button on the bottom-left corner of your Windows Desktop
  3. Type cmd to open the Command Prompt and press Enter
  4. Enter the command line:
    2PDF.exe -src "C:\Input\*.*" -dst "C:\Output"
  5. Press Enter

For more options, please see the complete description of 2PDF syntax and examples.

How to start 2PDF from a VB Script?

  1. Open Notepad and create a new text file in it
  2. Enter Visual Basic Script code like this:
    Set objShell = WScript.CreateObject("WScript.Shell")
    objShell.Run """2PDF.exe"" -src ""C:\In\*.*"" -dst ""C:\Out""", 1, True
    Set objShell = Nothing
  3. Save this file as a Unicode text file. For example: Test.txt
  4. Rename Test.txt file to Test.vbs
  5. Double click Test.vbs file to start the conversion

How to install 2PDF silently?

Download the installation file and save it on your hard drive. Run this command line to silently install the trial version of 2PDF:

"C:\Distr\2PDF-trial-setup.exe" /SILENT

Add a serial number to the command line to install the commercial version of 2PDF silently:

"C:\Distr\2PDF20-commerc-setup.exe" /SILENT /SN=AAAAAA-BBBBBB-CCCCCC-DDDDDD

I need a certain feature. Can you help? 

We continuously improve our products based on your suggestions. Please send us your feature requests, any feedback, or ask questions via the contact page.