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.
|