• Download Trial
  • Purchase
  • Contact Us
  • Login

ProductsGreat pdf developer solutions
  •  
  • PDFNet SDK
  • SilverDox SDK
  • PDF2Image
  • PDF2Text
  • XPSConvert
  • PDF2XPS
  • PDF2SVG
  • PDF PageMaster
  • PDF/A Manager
  • PDFSecure
  • PDF CosEdit
SupportDeveloper 2 developer support
  •  
  • Annual Maintenance Subscription
  • Technical Support & Resources
  • Professional Services
  • Support FAQ
ResourcesCommunity & developer resources
  •  
  • PDFTron Labs
  • Standards
  • PDF & Environment
  • Industry News
  • Newsletter
  • Whitepapers/Datasheets
Why PDFTronTrusted pdf experts with great solutions
  •  
  • Benefits
  • Our Customers
  • Testimonials
About UsThe story behind the company
  • News & Press
  • Contact Us
  • Careers
  • CO-OP &
    Internship Opportunities
  • Partners/Alliances
  • Resellers

Home // Products // XPSConvert // Support // FAQ

  • Products
  • PDFNet SDK
  • SilverDox SDK
  • PDF2Image
  • PDF2Text
  • XPSConvert
  • Overview
  • Benefits
  • Features
  • Support
  • What's New
  • Documentation
  • Sample Code
  • FAQ
  • Knowledge Base
  • Forum
  • Download Trial
  • PDF2XPS
  • PDF2SVG
  • PDF PageMaster
  • PDF/A Manager
  • PDFSecure
  • PDF CosEdit
Sub Navigation

Browse by Functionality

XPSConvert

FAQ

+How do I save converted files in a given folder?

By default, XPSConvert saves converted files in the current working folder. To specify another output location, use the ‘-o’ (or --output) parameter. For example:

xpsconvert –o “c:\My Output” 1.xps 2.xps 3.xps

Note:If the specified path does not exist, XPSConvert will attempt to create the necessary folders.

+How can I control the output name for converted files?

When converting to PDF, XPSConvert will, by default, create a single file with the name of the input XPS file.  The output filename can be changed using the ‘--prefix’ option.  For example, the following command-line generates an output document named outdoc.pdf:

xpsconvert –prefix outdoc mydoc.xps

The default behavior for image conversion is to create a separate image file for every page in the document. The output filename is constructed using the name of the input XPS file, page counter, and appropriate image extension. For example, the following command-line generates a sequence of image files starting with mydoc_1.jpg, mydoc_2.jpg, etc.:

xpsconvert –f jpg mydoc.xps

XPSConvert allows output filename customizations using the ‘--prefix’ and ‘--digits’ options. For example, the following command-line generates a sequence of image files starting with newname_0001.jpg, newname_0002.jpg, etc.:

xpsconvert –f jpg --prefix newname --digits 4 mydoc.xps

The ‘--digits’ parameter specifies the number of digits used in the page counter portion of the output filename. By default, new digits are added as needed, however this parameter could be used to format the page counter field to a uniform width (e.g. myfile_0001.jpg, myfile_0010.jpg, instead of myfile_1.jpg, myfile_10.jpg, etc).

If your output image format is TIFF, you can convert XPS to a single, multi-page TIFF document using the ‘--multipage’ option (See ‘How do I convert XPS to multi-page TIF?’ for an example).

To avoid any ambiguities in file naming, the prefix option should be used only for conversion of individual documents.

+How do I convert XPS to PDF, JPEG, PNG, TIF or some other format?

By default, XPSConvert automatically converts XPS to PDF. The output format can be modified using the ‘-f’ (or --format) option. For example,

xpsconvert –f jpg in.xps

will convert XPS to JPEG.

The ‘--format’ parameter accepts any of the following output formats:

  • pdf – (Portable Document Format)
  • png - (Portable Network Graphics)
  • png8 – (Palletized PNG)
  • jpg or jpeg (Joint Photographic Expert Group)
  • tif or tiff (Tagged Image File Format)
  • tif8  – (Palletized TIFF)
  • bmp (Windows Bitmap Format)
  • raw (raw RGB or Gray data)
+How do I specify which pages to convert?

By default, XPSConvert will convert all XPS pages to the output format. You can specify a subset of pages to convert using the ‘-a’ or ‘--pages’ options. For example:

xpsconvert -a 1,3,10 in.xps

will convert only pages 1, 3, and 10. Please note that XPSConvert assumes that all pages are numbered sequentially starting from page 1.

To specify a range of pages, use dash character between numbers. For example:

xpsconvert -a 1,10-20,50- in.xps

will render the first page, pages in the range from 10 to 20 and all pages starting with page 50 to the last page in the document.

All even pages can be selected using the ‘e’ (or ‘even’) string. For example, the following line renders all even pages:

xpsconvert --pages even in.xps

Similarly odd pages can be selected using the ‘o’ (or ‘odd’) string. The following line renders all odd pages in the document and every page in the range from 100 to the last page:

xpsconvert --pages odd,100- in.xps

+How do I convert unzipped XPS files?

By default, XPSConvert will convert XPS files if they are in zip format.  You can convert directories in XPS format by using the option --physical-model.  For Example:

xpsconvert --physical_model dir xps_dir

In this example ‘xps_dir’ could be created by unzipping an XPS file. This directory would contain files with XML markup and other XPS resources.

The “--physical_model” parameter accepts any of the following output formats:

  • zip (xps parts contained in a zip archive)
  • dir  (xps parts contained in a directory)
  • all   (processes both zip files and xps directories)
+How do I batch convert files?

XPSConvert supports batch conversion of many XPS files in a single pass. To convert all XPS files in a given folder(s) you can use the following syntax:

xpsconvert myfolder1

The ‘--subfolders’ option can be used to recursively process all subfolders. For example, the following line will convert all documents in ‘myfolder1’ and ‘myfolder2’ as well as all subfolders:

xpsconvert --subfolders myfolder1 myfolder2

By default, XPSConvert will convert all files with the extension ‘.xps’. To select different files based on the extension use the ‘--extension’ parameter. For example, to convert all XPS documents with a custom extension ‘.blob’, you could use the following line:

xpsconvert --extension .blob --subfolders myfolder1

The use of wild characters is also allowed. For example, to convert all XPS files starting with ‘x’ in the current folder use:

xpsconvert x*.xps
+How do I convert XPS to multi-page TIF?

If your output format is TIFF, you can convert XPS to a single, multi-page TIFF document instead of a separate file for every page using the ‘--multipage’ option.

For example:

xpsconvert --multipage -f tif --verb 3 myxps.xps
+How do I render XPS as CCITT Group 4 FAX TIFF or monochrome PNG

To render the XPS as a monochrome (1 bit per pixel) image compressed using G4 CCITT, simply add the option ‘--mono’ within the command-line string. For example,

xpsconvert --mono -f TIFF --verb 10 --dpi 300 in.xps

To enable dithering (grayscale color simulation) add ‘--dither’ option to the command line string.

+Does XPSConvert have any dependencies on third party components/software?

XPSConvert is a completely stand alone application and does not include any dependencies on third-party components or software.

+Can I use XPSConvert for XAML to PDF conversion?

XPSConvert can be used to for XAML to PDF conversion. To convert XAML to PDF first serialize flow document as XPS using specific styling information (e.g. page dimensions, header, footer, margins, etc), then pass the output to XPSConvert XPS to PDF conversion function.

In an application that uses Windows Presentation Foundation (WPD), writing the application's data as an XPS Document is straightforward. Windows Presentation Foundation applications describe their graphical content using Extensible Application Markup Language (XAML) code. XPS Documents use a subset of this code as their markup. A WPF application can create an XPS document by calling a method that flattens the application XAML elements of the page into to the XPS page markup.
A managed code application can also create the individual parts of an XPS Document by using the XPS Document API in the System.Windows.Xps.Serialization namespace. This may be a better option for retaining precise control over how the XPS Document is constructed or for adding additional metadata to the document. An application can also create an XPS Document directly, even if the application was not built using Windows Presentation Foundation. This can be done by creating the markup for the individual XPS Document parts, but the classes and methods described here that actually create the XPS Document only run in a managed code environment.

The XamlStreamToXps method from the sample code shown below can enable your WPF application to create an XPS Document. XamlStreamToXps accepts as its arguments the file name of the XPS Document to be created and a Stream containing XAML, which describes the document. XamlStreamToXps will read the input stream and create an XPS Document.

void XamlStreamToXps
  Stream srcXamlStream, ParserContext context, string destXpsFile)
{
    XpsDocument document =
        new XpsDocument(destXpsFile, FileAccess.ReadWrite);
    XpsPackagingPolicy packagePolicy = new XpsPackagingPolicy(document);
    XpsSerializationManager serializationMgr =
        new XpsSerializationManager(packagePolicy, false);
 
    object parsedDocObject = (null == context) ?
        XamlReader.Load (srcXamlStream) :
        XamlReader.Load (srcXamlStream, context);
 
    serializationMgr.SaveAsXaml(parsedDocObject);
    document.Close();
}
void XamlFileToXps(string srcXamlFile, string destXpsFile)
{
   using(Stream fileStream = File.OpenRead(srcXamlFile))
   {
      ParserContext context = new ParserContext();
      context.BaseUri = new Uri(Directory.GetCurrentDirectory() + "//");
      XamlStreamToXps(fileStream, context, destXpsFile);
   }
}

While the default conversion from XAML to XPS is very easy to use, if you want more features, you need to write some code. For full code samples and discussion on how to serialize XAML to XPS you may want to refer to the following resources: http://msdn.microsoft.com/en-us/magazine/cc163664.aspx http://www.pdftron.com/xpsconvert/forum.html

+Is XPSConvert available as an SDK for integration with third party applications?

For developers who are looking for a software development component to integrate into their application, PDFTron also offers XPSConvert SDK, an easy-to-use, yet powerful software component for embedding into client and server based applications. XPSConvert SDK is available as a shared library and can be easily accessed from any programming language (including C#, VB.NET, C/C++, Java, VB6, Perl, Python, Ruby, Delphi, etc). XPSConvert is also available as an add-on module to PDFNet SDK.

+ How do I render XPS as CMYK TIFF?

To render the XPS as a CMYK TIFF, simply add the option '--cmyk' or '-k' within the command-line string. For example, xpsconvert --cmyk -f TIFF --dpi 300 in.xps

Next Steps:
  • Download Trial
  • Purchase

See Licensing Options

Sub Navigation
  • 2011 PDFTRON SYSTEMS, INC, ALL RIGHTS RESERVED |
  • LEGAL |
  • SITEMAP |
  • CAREERS |
  • CONTACT US