To pass a command into PDF2XL CLI (version 6.5 and lower) or PDF2XL Enterprise (version 8.0 and higher), prefix it with a minus sign ('-'), otherwise, it will be treated as a filename (i.e., PDF2XL CLI will try to open a file in that name).

Each command will appear after a space, and if it has a value, it will be separated from it using an equal sign. If the value contains spaces, it MUST start and end with quotes, which will be removed from the value itself. If a quoted value has a quote inside, it needs to be doubled.
Also note, that it's best to use the quotes with the filenames, even if they contain no spaces, as those could change.

See the CLI Examples for samples on the usage of the commands and quotes.

Command line will return an error code if there was a problem with the command line.

Commands

----------------------------------------------------------------------------------

Version 8.0.1.9 and newer

-email=youremail
-pass=yourpassword
Version 8.0.1.9. added a couple of extra parameters to allow you to enter the login credentials to automatically connect during a command line conversion.
Note that it is necessary to run PDF2XL with those credentials at least once with the same user that will run the command line.

----------------------------------------------------------------------------------

Version 8.0.1.7 and earlier

-input
Loads the file.
example: -input=C:\Users\username\Desktop\cliconvert\convert1.pdf"
Can appear more than once, unless the Silent Mode command is used, in which case it must appear exactly once. If a filename appears in the command line without any flag, it will be used as input.

-layout
Loads a layout from the file.
example: -layout="C:\Users\username\Desktop\cliconvert\convert.layoutx"
Will be used on all the input flag files; overrides the layout saved for the input file (if any). 

-format
Sets the current conversion format.
example: -format=excelfile
Overrides the saved setting.
      Values:

  • excel 
  • excelfile 
  • word 
  • wordfile 
  • powerpoint 
  • powerpointfile 
  • calcfile 
  • csvfile 
  • clipboard 
  • excelclipboard 
  • wordclipboard 
  • html

-output
Sets the output filename.
example: -output="C:\Users\username\Desktop\cliconvert\convert1.xls"
Does not apply to formats without a file (clipboard, excelclipboard, wordclipboard).
Only valid when format appears and is set to excelfile, wordfile or csvfile.

-range
Sets the conversion page range.
example: -range="all"
Isn't valid if the document is a Scanned PDF Document.
      Values:

  • all 
  • current 
  • ask 
  • For single pages (ex, page 3 of a 5-page document), use the page number without quotes: -range=3
  • For specific pages (ex, pages 1 and 3 of a 5-page document), use the page numbers divided by a comma without quotes: -range=1,3
  • For a range of pages (ex, pages 1 to 3 of a 5-page document), use the page numbers divided by a dash without quotes: -range=1-3

-multiple
Used just like this, the "-multiple" command will extract a multiple page PDF into an Excel workbook containing individual sheets for each page.
example

"C:\Program Files (x86)\CogniView\PDF2XL\PDF2XL.exe" -input="C:\Users\[USER]\Documents\MyFile.pdf" -layout="C:\Users\[USER]\Documents\MyFile.layoutx" -format=excelfile -range="1-3" -multiple -output="C:\Users\[USER]\Documents\MyFile.xls" -noui 

-noui
Runs the application in Silent Mode.
Command line has to include input; will fail if no layout is defined for the file, or if converting to a file without an output file, or if the page range is set to current. 

-autoclose
Closes the file when it is converted; closes the application when the last file is converted.
When the -noui command is used, this command is applied automatically. 

-run
Converts the opened document immediately.
Command line must include input; will fail if no layout is defined for the file, or if converting to a file without an output file, or if the page range is set to current. When the -noui command is used, this command is applied automatically. 

-autoopen
If set to on, will open the Excel or Word file when the conversion is finished.
example: -autoopen=off
If set to off, will not display the file. If not specified, PDF2XL CLI will use the Open File after Conversion setting in the Conversion Settings page.
Valid only in combination with Silent Mode command.
      Values:

  • on
  •  off

-autolayout
Will automatically create a layout for each file (just like using the automatic layout detection in the Layout ribbon).
Valid only if no layout is specified (i.e., do not use the -layout command).

**This is not the same as using the "Convert Automatically" option in the user interface, which provides a much more precise layout. Using this command will not usually give you the same result that the UI Convert Automatically option provides.

It is not possible to use Convert Automatically in command line mode.

-existingfile
Set the handling of converting to an existing file (Excel only).
Overrides the saved setting.
      Values:

  • replace 
  • newsheets 
  • append

-template
Set the structure type for the document.
Overrides the saved setting.
      Values:

  • same 
  • different 
  • repeat

-pagerepeat
Set the number of pages per repetition, for a repeating template.
This option must appear if, and only if, the -template repeat option was used.

-firstpagediff
Set the First Page Different option, identical to the one in the Document Template dialog. This means that the first page does not repeat the layout in the same way as the rest of the document.
Overrides the saved setting.

-lastpagediff
Set the Last Page Different option, identical to the one in the Document Template dialog. This means that the last page does not repeat the layout in the same way as the rest of the document.
Overrides the saved setting.

-password
If you have a protected PDF file, including this command with the password will enter it into the document for silent conversion.
For example, if the password is 12345, the script would be -password=12345.
Note that this will only work on a single protected PDF and cannot be applied to multiple files in a folder.

Regarding Concurrent Conversion
PDF2XL CLI has the capability to run in multiple instances, however, we do not recommend it. The conversion process uses some limited system resources (such as the Excel runtime) that can cause conflicts.

Did this answer your question?