c# - Extract a single page from an XPS document -


I need to split an existing XPS document and create a new XPS document with only one page of the original one . I tried copying the document and removing the pages from the copied document, but it is very slow. Is there any more efficient way to do this? In C # please in

Thanks:

  Open the public document, using the string (Original String, String Decentination Document) {Package Package = Package Open (Original Document, Open File Modes, File accessed. Read)) {(Package packageDist = package.open (DISCONNEMENT DOCUMENT)} {string inMemoryPackageName = "memorystream: //miXps.xps"; Uri Package URI = New URI (InMemoryPackageName); Package Store Adepackage (package Yuri, package); XpsDocument xpsDocument = New XpsDocument (package, compression max, inMemoryPackageName); XpsDocument xpsDocumentDest = New XpsDocument (packageDest, compressionoption .doc, detinationDocument); Var Fixed Document Suction = xpsDocument.GetFixedDocumentSequence (); Document reference docReference = xpsDocument.GetFixedDocumentSequence (). Reference. First (); Fixed document doc = docReference.GetDocument (wrong); Var content = doc.Pages [2]; Var fixedPage = content.GetPageRoot (wrong); Var writter = XpsDocument.CreateXpsDocumentWriter (xpsDocumentDest); Writter.Write (fixedPage); XpsDocumentDest.Close (); XpsDocument.Close (); }}}}    

  1. create the destination XpsDocument
  2. Get the first page from
  3. Get a fixed page from PageContent <
  4. Easy.


    As stated, it is in step 6 hair instead of PageContent.GetPageRoot .

Comments