Rank: Guest
Groups: Guests
Joined: 1/5/2016(UTC) Posts: 162
Was thanked: 5 time(s) in 5 post(s)
|
hi,
Is there a way when i click on a bookmark in my list of bookmarks to display the page who correspond (in a pdf who contains multiple pages) ?
thank you
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Please look at bookmark's Action and Destination properties here: https://pdfium.patagames.com/help/html/39813c60-72f9-1565-4e1f-0de959822d66.htmThe destination contain the PageIndex property, so you may call PdfViewer.ScrollToPage(destination.PageIndex). Code:
if (Bookmark.Action != null)
ProcessAction(Bookmark.Action);
else if (Bookmark.Destination != null)
ProcessDestination(Bookmark.Destination);
Code:
private void ProcessAction(PdfAction pdfAction)
{
if (pdfAction.ActionType == ActionTypes.Uri)
Process.Start(pdfAction.ActionUrl);
else if (pdfAction.Destination != null)
ProcessDestination(pdfAction.Destination);
}
Code:
private void ProcessDestination(PdfDestination pdfDestination)
{
ScrollToPage(pdfDestination.PageIndex);
Invalidate();
}
Edited by user Thursday, April 7, 2016 4:23:55 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Guest
Groups: Guests
Joined: 1/5/2016(UTC) Posts: 162
Was thanked: 5 time(s) in 5 post(s)
|
thanks and how can i get the action from the bookmarkviewer (node clicked on the treeview) ?
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Code:
_bookmarksViewer.AfterSelect += _bookmarksViewer_AfterSelect;
Code:
private void _bookmarksViewer_AfterSelect(object sender, TreeViewEventArgs e)
{
var node = e.Node as BookmarksViewerNode;
if (node == null || node.Bookmark == null)
return;
if (node.Bookmark.Action != null)
ProcessAction(node.Bookmark.Action);
else if (node.Bookmark.Destination != null)
ProcessDestination(node.Bookmark.Destination);
}
BTW, you can do the following: Code:
pdfViewer1.BookmarksViewer = bookmarksViewer1
that's all Edited by user Friday, April 8, 2016 7:36:39 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Guest
Groups: Guests
Joined: 1/5/2016(UTC) Posts: 162
Was thanked: 5 time(s) in 5 post(s)
|
var node = e.Node as BookmarksViewerNode; it seems to be not possible, visual studio says it's not possible because its level protection "bookmarksviewermode" Edited by user Wednesday, April 13, 2016 2:30:36 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
if you are using bookmark viewer provided by sdk then you need the following only Code:
pdfViewer1.BookmarksViewer = bookmarksViewer1
PdfViewer implements the scroll to page on click on a bookmark functionality by default. Edited by user Wednesday, April 13, 2016 3:33:26 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Guest
Groups: Guests
Joined: 1/5/2016(UTC) Posts: 162
Was thanked: 5 time(s) in 5 post(s)
|
|
|
|
|
|
|
Rank: Guest
Groups: Guests
Joined: 1/5/2016(UTC) Posts: 162
Was thanked: 5 time(s) in 5 post(s)
|
there is a way to do the same thing with wpf pdfviewer?
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 6/6/2019(UTC) Posts: 5  Thanks: 2 times
|
Hi there,
could you point me to an example on how to implement a bookmark viewer in WPF.
Cheers!
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
BookmarksViewer code on WinForms is very simple. There are literally a few lines of code. Therefore, you can easily implement it in the WPF yourself, using any standard control suitable for your application. Source code can be found here: https://github.com/Patag...aster/BookmarksViewer.cs
|
|
|
|
|
|
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can 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