I have an XPS document generated in code that has a visual image. I am assigning the same XPS document to a WPF documentViewer, as shown in the code snippet below:
.cs file
xp = new XpsDocument(pack, CompressionOption.Fast, URIAdress); FixedDocumentSequence fixedDocumentSequence = xp.GetFixedDocumentSequence(); documentViewer.Document = fixedDocumentSequence as IDocumentPaginatorSource;
.XAML file
<DocumentViewer Name="uxDocumentViewerWithImage" Width="Auto" />
Problem . When I want my client to see the document viewer, he cropped the image of the XPS document on the right side. One solution is to reduce the size of the image, but due to the requirements, I cannot resize the image.
Please tell me how can I make the image fully visible in the document viewer?
Update : I tried the following solution, with which it worked, but with assignment of the width value of the hard code:
(fixedDocumentSequence as IDocumentPaginatorSource).DocumentPaginator.GetPage(pageIndex).Visual as FixedPage).Width = widthToAdjust;
Looking for a more general aproach here, for example, switching to LandScape mode? but I donβt know how: (
source share