I try to show the XPS file on one page at a time, and then using the timer change pages, the problem is that when I use the method FitToHeight, it shows more than one page, about a half page. I am not sure how to resize a DocumentViewer view.
This is the code I use to extract the XPS file. (PowerPoint slides printed in XPS format)
XpsDocument xpsDoc = new XpsDocument(
System.IO.Path.Combine(
AppDomain.CurrentDomain.BaseDirectory, "DemoDeck.xps"),
FileAccess.Read);
myDocumentViewer.Document = xpsDoc.GetFixedDocumentSequence();
This is XAML for my DocumentViewer.
<DocumentViewer x:Name="myDocumentViewer" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" HorizontalContentAlignment="Center"
VerticalContentAlignment="Center" MaxPagesAcross="1" Zoom="100">
<DocumentViewer.Resources>
<Style TargetType="ContentControl">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
<Style TargetType="ToolBar">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
<Style TargetType="ScrollViewer">
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
</Style>
</DocumentViewer.Resources>
</DocumentViewer>
source
share