Click here to Skip to main content
16,017,502 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have seen a XPS Document Viewer sample in the http://www.intersoftpt.com[^],it's perfect.

How can I get the source code of this sample?
Thanks.

The sample address: http://live.clientui.com/#/DocumentViewers/XPSDocumentViewer/MultiplePageXPS[^]
Posted
Updated 29-Feb-12 20:39pm
v3
Comments
André Kraak 1-Mar-12 2:39am    
Edited question:
Formatted text/code
"Treat my content as plain text..." option disabled.
Sergey Alexandrovich Kryukov 1-Mar-12 2:43am    
Thank you very much, André, but by this moment I already answered... and tested the code, please see...
--SA
usolo 1-Mar-12 3:34am    
Actually,I have made a xps document reader with XpsDocument.But there is a problem.When I opend the xps file ,there was no Document Struct Navigation.How can I made it 'appear'?

1 solution

This code sample is just few lines of code. You can find it here, at the very end of the MSDN help page on the class System.Windows.Xps.Packaging.XpsDocument in the section "Community Content":
http://msdn.microsoft.com/en-us/library/system.windows.xps.packaging.xpsdocument.aspx[^].

Don't forget: you need to add the reference to the assembly "ReachFramework.DLL" which is bundled with .NET Framework v.3.5 and later, so add it from the ".NET" tab of the window "Add Reference".

The idea is:
C#
//assuming this is the file name of some XPS document:
string fileName; //assign appropriate path name to it, from file dialog, for example

System.Windows.Controls.DocumentViewer viewer; //should be initialized and inserted in UI

//...

System.Windows.Xps.Packaging.XpsDocument doc =
    new System.Windows.Xps.Packaging.XpsDocument(fileName, System.IO.FileAccess.Read);
viewer.Document = doc.GetFixedDocumentSequence(); //viewing it!

It works, tested.

—SA
 
Share this answer
 
v6

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900