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