Rank: Newbie
Groups: Registered
Joined: 7/21/2017(UTC) Posts: 5  Location: Michigan Thanks: 1 times
|
My primary goal is to have two PDF viewers; one being a thumbnail viewer and the second one being the primary page viewer. I have successfully gotten both viewers to display the document but am confused on how to get them to interact with one another.
I would ideally like to click on a thumbnail in the left panel and bring that page to focus in the viewer panel. Is this at all possible and if so could someone please provide some code example to link the two viewers?
Thank you for your time and help!
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Well... XAML: Code:
<ScrollViewer Grid.Row="1" Grid.Column="0" CanContentScroll="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Wpf:PdfViewer Name="pdfViewerThumbnails"
ViewMode="Vertical"
MouseMode="None"
RenderFlags="FPDF_HQTHUMBNAIL"
CurrentPageChanged="pdfViewerThumbnails_CurrentPageChanged"/>
</ScrollViewer>
<ScrollViewer Grid.Row="1" Grid.Column="1" CanContentScroll="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Wpf:PdfViewer Name="pdfViewerPrimary" CurrentPageChanged="pdfViewerPrimary_CurrentPageChanged" />
</ScrollViewer>
Code behind: Code:
PdfCommon.Initialize();
...
pdfViewerThumbnails.LoadDocument(@"d:\1\Pdfium.Net SDK - EULA.pdf");
pdfViewerPrimary.LoadDocument(@"d:\1\Pdfium.Net SDK - EULA.pdf");
...
private void pdfViewerThumbnails_CurrentPageChanged(object sender, EventArgs e)
{
try
{
pdfViewerPrimary.CurrentPageChanged -= pdfViewerPrimary_CurrentPageChanged;
pdfViewerPrimary.ScrollToPage(pdfViewerThumbnails.CurrentIndex);
pdfViewerPrimary.CurrentIndex = pdfViewerThumbnails.CurrentIndex;
}
finally
{
pdfViewerPrimary.CurrentPageChanged += pdfViewerPrimary_CurrentPageChanged;
}
}
private void pdfViewerPrimary_CurrentPageChanged(object sender, EventArgs e)
{
try
{
pdfViewerThumbnails.CurrentPageChanged -= pdfViewerThumbnails_CurrentPageChanged;
pdfViewerThumbnails.ScrollToPage(pdfViewerPrimary.CurrentIndex);
pdfViewerThumbnails.CurrentIndex = pdfViewerPrimary.CurrentIndex;
}
finally
{
pdfViewerThumbnails.CurrentPageChanged += pdfViewerThumbnails_CurrentPageChanged;
}
}
|
 1 user thanked Paul Rayman for this useful post.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/21/2017(UTC) Posts: 5  Location: Michigan Thanks: 1 times
|
Thank you so much for your fast response! I will try thing first thing on Monday and let you know the results!
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/21/2017(UTC) Posts: 5  Location: Michigan Thanks: 1 times
|
This is extremely close to what i desire, however after playing with it i am trying to make a slight change but am struggling at how to accomplish it. I would like to be able to scroll on both (which it does currently) however only change the page when scrolled on the primary viewer but when a user clicks on a thumbnail it will load into that page in the primary.
Currently if scrolled through the thumbnails it will load the top most thumbnail.
Thanks again for all your help!
|
|
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close