PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

save pdf in xps format
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1887
Page 1 of 1

Author:  uka [ Wed Jan 18, 2012 7:32 am ]
Post subject:  save pdf in xps format

hello all,

i am new to wpf, i want to open/view a pdf file in wpf application and not in a new window, for this purpose im using DocumentViewer control in wpf.

PdfDocument pdf_document = new PdfDocument(this.textBox1.Text);
PdfPage pdf_page = pdf_document.AddPage();
System.IO.MemoryStream ms = new System.IO.MemoryStream();
pdf_document.Save(somepath + "Ot.xps");
pdf_document.Save(ms);
string pack = "pack://te.xps";
Package package = Package.Open(filename, FileMode.Open);
XpsDocument xpsdocument = new XpsDocument(package);
PackageStore.AddPackage(new Uri(pack), package);

XpsDocument doc = new XpsDocument(package, CompressionOption.SuperFast, pack);
this.documentViewer1.Document = doc.GetFixedDocumentSequence();

but im getting an error --> {"Archive file cannot be size 0."},
how to save a pdf document (currently using pdfsharp) in xps format and how to open the pdf file in documentviewer control.

thanks in advance.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/