How to use Soda PDF with Command Lines

You can use certain features of Soda PDF at a command line level.

All commands start with «“C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools». Following this will be the specific command you want to execute.
Below you’ll find a description of the available command options. 

Here are the features you can use at a command level:

Create PDFs (Another file type to PDF)
Convert PDFs (PDF to another file type)
Reduce File Size
OCR

1. Create PDFs (Another file to PDF) 

Your command line will look like this:
"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --create --source-file|--source-dir [--destination-dir]
 
Here is a description of each command element:

  • -- create – This means you plan to create a new PDF.
  • --source-file|--source-dir – (Required):
    • --source-file – The location of the original file.
    • —source-dir – The path to the file system catalog where the documents that wait for creation are stored.
  • --destination-dir – The target destination for your new PDF. This is not required, if this element is not added, the file will be created at the source.

 

Example:

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --create --source-file "X:\source\source.doc"
"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --create --source-file "X:\source\source.doc" --destination-dir "X:\destination"
"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --create --source-dir "X:\source"
"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --create --source-dir "X:\source" --destination-dir "X:\destination"

2. Convert converts PDF document into another file format 


Your command line will look like:
"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 0 --source-file|--source-dir [--destination-dir] [--use-ocr] [--convert-table] [--convert-method] [--image-type 0] [--page-divider 1] [--custom-divider] [--convert-crop-text]

 

Here is a description of each command element:

  • -- convert– This means you plan to convert a PDF to another file type.
  • --source-file|--source-dir – (Required):
    • --source-file – The location of the original file.
    • —source-dir – The path to the file system catalog where the documents that wait for creation are stored.
  • --destination-dir – The target destination for your new PDF. This is not required, if this element is not added, the file will be created at the source.
  • --pdf2format – (Required) Here you will set the output format. It is defined by a numerical value:
    • 0 – Word
    • 1 – Excel
    • 2 – PowerPoint
    • 3 – HTML
    • 4 – Image
    • 5 – Txt
    • 6 – RTF
  •  --use-ocr  While not required, you can use the OCR engine to make any text found in the images within your PDF.
    • This command is applied when converting to the following formats: Word, Excel, PowerPoint, HTML, Txt, RTF.
  • --convert-table – This option is not required but can be used to detect and convert tables in your PDF. 
    • This command works with the following output formats: Word, PowerPoint, RTF. This parameter is not the required parameter. 
  • --convert-method – This option is exclusive to conversions from PDF to Excel. You need to set how Excel will interpret your PDF using a numerical command:
    • 0 – Each table in your PDF will be a separate sheet in Excel.
    • 1 – The text found in your PDF will be added to an Excel spreadsheet.
    • 2 – If no option is specified, this will be the default. The text and tables found in your PDF will be re-created in Excel matching the formatting in the PDF.   
  • --image-type – When converting to image, you need to specify the format. Using a numerical value, you will choose from one of the following:
    • 0 – PNG – (Default value if none are specified).
    • 1 – JPEG
    • 2 – GIF
    • 3 – BMP
    • 4 – TIFF
  • --page-divider This option is applied when converting to TXT, to create line breaks at each page in your PDF. The following options are available:
    • 0 - Custom Divider 
    • 1 - Absent divider – (Default Value)
    • 2 - Line break
    • 3 - Double line break
    • 4 - '////////////////////'
    • 5 - '-------------------'
    • 6 - '1, 2, 3'
    • 7 - '-1-, -2-, -3-'
    • 8 - '1 of n'
    • 9 - '1/n'
    • 10 - 'Page 1'
    • 11 - 'Page 1 of n'.
  • --convert-crop-text – This parameter is used when converting to TXT. Using this will convert any cropped text.

 

Find below the list of the applied commands: 

File format

                               All applied commands

Word

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 0 --source-file "X:\path\file.pdf" [--destination-dir "X:\Dest_path"] [--use-ocr] [--convert-table]

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 0 --source-dir "X:\path" [--destination-dir "X:\Dest_path"] [--use-ocr] [--convert-table]

Excel

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 1 --source-file "X:\path\file.pdf" [--destination-dir "X:\Dest_path"] [--use-ocr] [--convert-method]

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 1 --source-dir "X:\path" [--destination-dir "X:\Dest_path"] [--use-ocr] [--convert-method]

PowerPoint

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 2 --source-file "X:\path\file.pdf" [--destination-dir "X:\Dest_path"] [--use-ocr] [--convert-table]

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 2 --source-dir "X:\path" [--destination-dir "X:\Dest_path"] [--use-ocr] [--convert-table]

HTML

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 3 --source-file "X:\path\file.pdf" [--destination-dir "X:\Dest_path"] [--use-ocr]

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 3 --source-dir "X:\path" [--destination-dir "X:\Dest_path"] [--use-ocr]

Image

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 4 --source-file "X:\path\file.pdf" [--destination-dir"X:\Dest_path"] [--image-type 0]

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 4 --source-dir "X:\path" [--destination-dir"X:\Dest_path"] [--image-type 0]

Txt

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 5 --source-file "X:\path\file.pdf" [--destination-dir "X:\Dest_path"] [--use-ocr] [--page-divider 0] [--custom-divider "custom page divider"] [--convert-crop-text]

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 5 --source-dir "X:\path" [--destination-dir "X:\Dest_path"] [--use-ocr] [--page-divider 0] [--custom-divider "custom page divider"] [--convert-crop-text]

RTF

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 6 --source-file "X:\path\file.pdf" [--destination-dir "X:\Dest_path"] [--use-ocr] [--convert-table]

"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --convert --pdf2format 6 --source-dir "X:\path" [--destination-dir "X:\Dest_path"] [--use-ocr] [--convert-table]


3. Reduce file size  


If you want to make your PDFs smaller, your command line will look like this:
"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --reduce-file-size --source-file|--source-dir --destination-dir [--reduce-quality]

Here is a description of each command element:

  • --reduce-file-sizeThis lets you compress your file.
  • --source-file|--source-dir(Required):
    • --source-file – The location of the original file.
    • —source-dir – The path to the file system catalog where the documents that wait for creation are stored.
  • --destination-dir The target destination for your new PDF. This is not required, if this element is not added, the file will be created at the source.
  • --reduce-qualityHere you will be able to set the how much you want to reduce the quality (and in turn file size), set the numerical value accordingly:
    • 0 – Min
    • 1 – Low
    • 2 – Medium – (Default value if none are specified).
    • 3 – High
    • 4 – Max

4. OCR 

If you want to use the OCR engine, making the text in your images editable, your command line will look like this:
"C:\Program Files\Soda PDF Desktop 11\soda.exe" --pdf-tools --recognize --source-file|--source-dir --destination-dir

Here is a description of each command element:

  • -recognize - This option lets you use the OCR engine.
  • --source-file|--source-dir(Required):
    • --source-file – The location of the original file.
    • —source-dir – The path to the file system catalog where the documents that wait for creation are stored.
  • --destination-dir The target destination for your new PDF. This is not required, if this element is not added, the file will be created at the source.

Was this article helpful?

Yes No
7 out of 15 found this helpful
Have more questions? Submit a request