XML Paper Specification (XPS) is a standard document format that Microsoft created in 2006 as an alternative to the PDF format. The XPS format is intended to be a simple but secure file format, without embedded images or video clips, and easy to share and print. Any document can be saved as an XPS file by printing to the Microsoft XPS Document Writer printer driver. Then, it can be opened in the XPS Viewer, provided with Windows 7.
You can use this sample program to convert XPS files to PDF format. The program generates a PDF output file.
This sample program adds one PDF file to another. The program offers two optional input documents and defines a default output document. You can enter your own PDF file names in the sample code or provide file names in a command line statement. The program will add the pages from the second file you enter to the end of the first file, and generate a third PDF file as output.
This program converts a PDF file that you provide into the PDF/A format, and generates a PDF output file. If you open the PDF output file, it will look like your original, but PDF/A has some important differences.
PDF/A is an ISO-standard version the PDF format. Adobe introduced PDF in 1993, and the International Organization for Standardization (ISO) took management of PDF as an open standard in 2008. ISO released PDF/A as a lighter version of the original PDF format in 2005. It is designed to be used with PDF files that need to be archived and stored for long periods. For example, the fonts in a PDF/A file are embedded in the file itself, rather than accessed through a link to a font directory on a local server.
This sample program converts a PDF document into a PDF/X compliant document.
PDF/X is used for the graphic arts and printing community, where colors must be completely accurate. The format places restrictions on PDF files so that PDF/X versions of those files can be transmitted reliably through a graphic arts workflow and printed with the colors and appearance that the person creating the PDF/X file is looking for. PDF/X has largely replaced the use of TIFF and other raster-based formats and EPS files in many graphics arts workflows where color is critical, such as in producing catalogs and magazines.
This sample uses the CloneAsPDFXDocument method, which take a PDFXConverParams and a PDFXConvertType as input parameters. The function returns a PDFXConverResult object which contains a member that shows whether the document was converted successfully. If the PDF was successfully converted the PDF/X-compliant document, based on the PDFXConvertResult object, it is assigned to a new document object which can then be saved. The save call must use the PDXSaveResultSave flags to save the compliance changes.
This sample shows how to take an input PDF document with the input ZUGFeRD invoice XML file and convert it to a ZUGFeRD compliant PDF document. The command statement provides the name of the input PDF document and the name of the input ZUGFeRD XML invoice file. The program adds the XML to the PDF document’s name tree as an attachment and saves the PDF output as PDF/A3. The sample also adds the ZUGFeRD metadata entries and the extension schema to the PDF, so that the output file is compliant with the PDF/A standard.
We provide more detail about the PDF/A format and ZUGFeRD standard.