Some test text!

menu
search
Usagekeyboard_arrow_down

Usage

PDFTron XpsConvert is a command-line application designed to convert XPS documents or XPS uncompressed folders to one or more PDF, BMP, PNG, JPEG, TIFF, or RAW files while presenting several options to control resolution, color, and quality depending on the output format selected. This section covers the basic usage of XPSConvert explaining all of the available options.

linkBasic Syntax

The basic command-line syntax is:

xpsconvert [options] file1 file2 folder1 file3 ...

See more options in Command-Line Summary for XpsConvert

linkGeneral Usage Examples

linkExample 1. The simplest command line: Convert XPS to PDF.

Notes:

  • The default output format is PDF.
  • The '-o' (or --output) parameter is used to specify the output folder. If this option was not specified, all images would be stored in the current working folder.

xpsconvert -o ex1 test/tiger.xps

linkExample 2. Convert XPS to PNG

  • By default all images will be rendered at 92 Dots Per Inch (DPI).

xpsconvert -f png -o ex1 test/tiger.xps

linkExample 3. Convert XPS to JPEG at 300 DPI and higher compression.

Notes:

  • The '-d' (or --dpi) parameter is used to specify the output image resolution.
  • The '-f' (or --format) parameter specifies that the output format is JPEG.
  • The '--verb' option instructs XPSConvert to output more feedback in the console window.

xpsconvert --output ex2 -d 300 -f jpg --verb 2 --quality 60 test/tiger.xps

linkExample 4. Convert XPS to a TIFF file of given pixel dimensions.

Notes:

  • In this example, the '--hres' and '--vres' parameters are used instead of the '--dpi' parameter to specify absolute dimensions of the target image.

xpsconvert -o ex3 --hres 1000 --vres 1000 -f tif --verb 2 test/blue_secret.xps

linkExample 5. Convert XPS to multi-page TIFF.

To convert a XPS file to a multi-page TIFF, you can use the following lines:

xpsconvert **-o OUT2 --multipage -f tif --gray --verb 2 D:\**

xpsconvert --subfolders -o OUT2 --multipage -f tif --verb 3 "D:\MyXPS"

linkBatch Processing and the Use of Wildcards

XPSConvert supports processing of multiple input documents in the same run. For example, it is possible to specify multiple XPS folders and XPSConvert will automatically process all XPS documents matching a given file extension. For example, the following command-line will process all XPS documents in folders 'test1' and 'test2'

c:\> xpsconvert -o c:/output_folder c:/test1 c:/test2

Wildcard characters can also be used to process multiple input files.

For example, if a directory contains the following XPS documents:

C:\test1 >dir
 Directory of C:\test1
 01/04/2007 03:35 PM <DIR> .
 01/04/2007 03:35 PM <DIR> ..
 05/21/2004 02:27 PM A1.xps
 05/03/2005 09:38 AM A2.xps
 05/20/2003 08:46 AM B1.xps
 05/15/2003 12:50 PM B2.xps

To process all XPS documents in this folder, you could specify:

xpsconvert -o c:/output_folder c:/test1/*.xps

To process all XPS documents staring with 'A', you could specify:

xpsconvert -o c:/output_folder c:/test1/A*.xps

Or to process all XPS documents ending with '1', you could specify:

xpsconvert -o c:/output_folder c:/test1/*1.xps

You can use either of the two standard wildcards --- the question mark (?) and the asterisk (*) --- to specify filename and path arguments on the command line.

The wildcards are expanded in the same manner as operating system commands. (Please refer to your operating system user's guide if you are unfamiliar with wildcards). Enclosing an argument in double quotation marks (" ") suppresses the wildcard expansion. Within quoted arguments, you can represent quotation marks literally by preceding the double-quotation-mark character with a backslash (\). If no matches are found for the wildcard argument, the argument is passed literally.

linkExit Codes

To provide additional feedback, XPSConvert returns exit codes after completing processing. The exit codes can be used to provide user feedback, for logging etc. This is particularly important for applications running in an unattended environment.

The following table lists possible exit codes and their description:

Exit Code       Description
--------------- ---------------------------------------
0               All files converted successfully.
1               Unspecified error.
2               Bad license key
3               Failed to create the output directory
4               Bad input filename or path

All codes other then '0' indicate that there was an error during the conversion process.

The following illustrates a sample Windows batch script that processes exit codes:

@echo off rem convert all XPS files in 'data' folder
XPSConvert ./data
if errorlevel 1 goto othererror
if errorlevel 4 goto inputerr
if errorlevel 0 goto exit

:inputerr
echo No input files specified.
goto exit

:othererror
echo An error encountered during processing.
goto exit

:exit

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn more
close