logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Guest  
#1 Posted : Thursday, April 7, 2016 5:04:41 AM(UTC)
Guest

Rank: Guest

Groups: Guests
Joined: 1/5/2016(UTC)
Posts: 139

Was thanked: 4 time(s) in 4 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
Paul Rayman  
#2 Posted : Thursday, April 7, 2016 7:21:01 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 743

Thanks: 1 times
Was thanked: 90 time(s) in 89 post(s)
Please look at bookmark's Action and Destination properties here: https://pdfium.patagames.com/help/html/39813c60-72f9-1565-4e1f-0de959822d66.htm

The 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 7:23:55 AM(UTC)  | Reason: Not specified

Guest  
#3 Posted : Friday, April 8, 2016 7:35:54 AM(UTC)
Guest

Rank: Guest

Groups: Guests
Joined: 1/5/2016(UTC)
Posts: 139

Was thanked: 4 time(s) in 4 post(s)
thanks and how can i get the action from the bookmarkviewer (node clicked on the treeview) ?
Paul Rayman  
#4 Posted : Friday, April 8, 2016 10:32:37 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 743

Thanks: 1 times
Was thanked: 90 time(s) in 89 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 10:36:39 AM(UTC)  | Reason: Not specified

Guest  
#5 Posted : Wednesday, April 13, 2016 5:14:08 AM(UTC)
Guest

Rank: Guest

Groups: Guests
Joined: 1/5/2016(UTC)
Posts: 139

Was thanked: 4 time(s) in 4 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 5:30:36 AM(UTC)  | Reason: Not specified

Paul Rayman  
#6 Posted : Wednesday, April 13, 2016 6:30:37 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 743

Thanks: 1 times
Was thanked: 90 time(s) in 89 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 6:33:26 AM(UTC)  | Reason: Not specified

Guest  
#7 Posted : Wednesday, April 13, 2016 6:50:03 AM(UTC)
Guest

Rank: Guest

Groups: Guests
Joined: 1/5/2016(UTC)
Posts: 139

Was thanked: 4 time(s) in 4 post(s)
OMG it works :D? THANKS
Guest  
#8 Posted : Monday, April 25, 2016 5:10:17 AM(UTC)
Guest

Rank: Guest

Groups: Guests
Joined: 1/5/2016(UTC)
Posts: 139

Was thanked: 4 time(s) in 4 post(s)
there is a way to do the same thing with wpf pdfviewer?
claudiu  
#9 Posted : Thursday, June 6, 2019 8:08:34 PM(UTC)
claudiu

Rank: Newbie

Groups: Registered
Joined: 6/6/2019(UTC)
Posts: 1
Canada

Hi there,

could you point me to an example on how to implement a bookmark viewer in WPF.

Cheers!
Paul Rayman  
#10 Posted : Friday, June 14, 2019 4:42:50 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 743

Thanks: 1 times
Was thanked: 90 time(s) in 89 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
Users browsing this topic
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.