//Create converter class XPSToPdfConverter converter = new XPSToPdfConverter();
string xpsPath = "../../../Data/source.xps";
// An xps document is one or more FixedDocuments containing FixedPages FixedDocument fDoc = new FixedDocument();
XpsDocument xps = new XpsDocument(xpsPath, FileAccess.Write, CompressionOption.Maximum); System.Windows.Xps.XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(xps);
writer.Write("source.xps"); xps.Close();
FileStream fStream = File.OpenRead(xpsPath); Syncfusion.Pdf.PdfDocument pdf = converter.Convert(fStream); fStream.Close();
using (var doc = converter.Convert(fStream)) {
MemoryStream ms = new MemoryStream(); doc.Save(ms); // write directly to the file
File.WriteAllBytes("output.pdf", ms.ToArray());
//Open the Pdf document System.Diagnostics.Process.Start("output.pdf");
doc.Close(true); }
|