4

I have an XPS document generated in code which is having a image visual. I am assigning the same XPS Document to a WPF documentViewer control as shown below in the code snippet:

.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 luanch my client to see the document viewer, it trimmed the image of XPS document from right hand side. One solution is to reduce the size of image, but due to requirements I can not modify the image size.

Please suggest how can I make the image visible fully on the document viewer?

Update: I tried the following solution it worked but with assigning hardcode width value:

(fixedDocumentSequence as IDocumentPaginatorSource).DocumentPaginator.GetPage(pageIndex).Visual as FixedPage).Width = widthToAdjust;  // Hard Code Width value

Still looking for more generic aproach here, like moving to LandScape mode ? but do not know how :(

Dadwals
  • 1,171
  • 2
  • 8
  • 15

0 Answers0