Class XPSToPdfConverter
Represents the XPS to PDF converter.
Inheritance
Namespace: Syncfusion.XPS
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class XPSToPdfConverter : Object
Remarks
This API is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.
Examples
//Create new instance for XPSToPdfConverter
XPSToPdfConverter converter = new XPSToPdfConverter();
//Converts XPS to PDF
PdfDocument pdfDocument = converter.Convert("XPSToPDF.xps");
//Save the PDF document
pdfDocument.Save("Output.pdf");
//Closing the PDF document
pdfDocument.Close(true);
'Create new instance for XPSToPdfConverter
Dim converter As New XPSToPdfConverter()
'Converts XPS to PDF
Dim pdfDocument As PdfDocument = converter.Convert("XPSToPDF.xps")
'Save the PDF document
pdfDocument.Save("Output.pdf")
'Closing the PDF document
pdfDocument.Close(True)
Constructors
XPSToPdfConverter()
Initializes a new instance of the XPSToPdfConverter class.
Declaration
public XPSToPdfConverter()
Remarks
This constructor is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.
Examples
//Create new instance for XPSToPdfConverter
XPSToPdfConverter converter = new XPSToPdfConverter();
//Converts XPS to PDF
PdfDocument pdfDocument = converter.Convert("XPSToPDF.xps");
//Save the PDF document
pdfDocument.Save("Output.pdf");
//Closing the PDF document
pdfDocument.Close(true);
'Create new instance for XPSToPdfConverter
Dim converter As New XPSToPdfConverter()
'Converts XPS to PDF
Dim pdfDocument As PdfDocument = converter.Convert("XPSToPDF.xps")
'Save the PDF document
pdfDocument.Save("Output.pdf")
'Closing the PDF document
pdfDocument.Close(True)
XPSToPdfConverter(XPSToPdfConverterSettings)
Initialize a new instance of the XPSToPdfConverter class.
Declaration
public XPSToPdfConverter(XPSToPdfConverterSettings settings)
Parameters
Type | Name | Description |
---|---|---|
XPSToPdfConverterSettings | settings | The XPS to PDF converter settings. |
Examples
//Create new XPS to PDF converter settings instance.
XPSToPdfConverterSettings settings = new XPSToPdfConverterSettings();
//Enable enbed complete font.
settings.EmbedCompleteFont = true;
//Create a new XPS to PDF converter.
XPSToPdfConverter converter = new XPSToPdfConverter(settings);
//Convert the XPS file to PDF.
PdfDocument document = converter.Convert("input.xps");
//Save the PDF document.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create new XPS to PDF converter settings instance.
Dim settings As New XPSToPdfConverterSettings()
'Enable enbed complete font.
settings.EmbedCompleteFont = True
'Create a new XPS to PDF converter.
Dim converter As New XPSToPdfConverter(settings)
'Convert the XPS file to PDF.
Dim document As PdfDocument = converter.Convert("input.xps")
'Save the PDF document.
document.Save("output.pdf")
'Close the PDF document.
document.Close(True)
Properties
Settings
Enable or disable embedding complete font
Declaration
public XPSToPdfConverterSettings Settings { get; set; }
Property Value
Type |
---|
XPSToPdfConverterSettings |
Remarks
By enabling this propety the size of the output PDF will be larger.
Examples
//Create a new XPS to PDF converter.
XPSToPdfConverter converter = new XPSToPdfConverter();
//Create new XPS to PDF converter settings instance.
XPSToPdfConverterSettings settings = new XPSToPdfConverterSettings();
//Enable enbed complete font.
settings.EmbedCompleteFont = true;
//Assign settings to XPS converter.
converter.Settings = settings;
//Convert the XPS file to PDF.
PdfDocument document = converter.Convert("input.xps");
//Save the PDF document.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new XPS to PDF converter.
Dim converter As New XPSToPdfConverter()
'Create new XPS to PDF converter settings instance.
Dim settings As New XPSToPdfConverterSettings()
'Enable enbed complete font.
settings.EmbedCompleteFont = True
'Assign settings to XPS converter.
converter.Settings = settings
'Convert the XPS file to PDF.
Dim document As PdfDocument = converter.Convert("input.xps")
'Save the PDF document.
document.Save("output.pdf")
'Close the PDF document.
document.Close(True)
Methods
Convert(Byte[])
Converts the byte array with XPS file content to PDF
Declaration
public PdfDocument Convert(byte[] file)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | file | XPS document |
Returns
Type | Description |
---|---|
PdfDocument | PdfDocument |
Remarks
This method is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.
Examples
//Create new instance for XPSToPdfConverter
XPSToPdfConverter converter = new XPSToPdfConverter();
//Converts XPS to PDF
PdfDocument pdfDocument = converter.Convert(XpsByte);
//Save the PDF document
pdfDocument.Save("Output.pdf");
//Closing the PDF document
pdfDocument.Close(true);
'Create new instance for XPSToPdfConverter
Dim converter As New XPSToPdfConverter()
'Converts XPS to PDF
Dim pdfDocument As PdfDocument = converter.Convert(XpsByte)
'Save the PDF document
pdfDocument.Save("Output.pdf")
'Closing the PDF document
pdfDocument.Close(True)
Convert(Stream)
Converts the XPS document in stream to PDF.
Declaration
public PdfDocument Convert(Stream file)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | file | XPS document |
Returns
Type | Description |
---|---|
PdfDocument | PdfDocument |
Remarks
This method is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.
Examples
//Create new instance for XPSToPdfConverter
XPSToPdfConverter converter = new XPSToPdfConverter();
//Converts XPS to PDF
PdfDocument pdfDocument = converter.Convert(XpsStream);
//Save the PDF document
pdfDocument.Save("Output.pdf");
//Closing the PDF document
pdfDocument.Close(true);
'Create new instance for XPSToPdfConverter
Dim converter As New XPSToPdfConverter()
'Converts XPS to PDF
Dim pdfDocument As PdfDocument = converter.Convert(XpsStream)
'Save the PDF document
pdfDocument.Save("Output.pdf")
'Closing the PDF document
pdfDocument.Close(True)
Convert(String)
Declaration
public PdfDocument Convert(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName |
Returns
Type |
---|
PdfDocument |
Examples
//Create new instance for XPSToPdfConverter
XPSToPdfConverter converter = new XPSToPdfConverter();
//Converts XPS to PDF
PdfDocument pdfDocument = converter.Convert("XPSToPDF.xps");
//Save the PDF document
pdfDocument.Save("Output.pdf");
//Closing the PDF document
pdfDocument.Close(true);
'Create new instance for XPSToPdfConverter
Dim converter As New XPSToPdfConverter()
'Converts XPS to PDF
Dim pdfDocument As PdfDocument = converter.Convert("XPSToPDF.xps")
'Save the PDF document
pdfDocument.Save("Output.pdf")
'Closing the PDF document
pdfDocument.Close(True)