PDF - jump to named destination?
PDF - jump to named destination?
We currently have several PDF documents which have named destinations defined in them. We use a third-party component to render the PDFs, and in certain circumstances, to jump to one of the named destinations. Is there a way to navigate to a named destination within a PDF with the GdViewer component? Or perhaps the PDF plugin?
Re: PDF - jump to named destination?
Hello,
Latest version of GdPicture.NET automatically jumps to any kind of destination. Have you tried it?
With best regards,
Loïc
Latest version of GdPicture.NET automatically jumps to any kind of destination. Have you tried it?
With best regards,
Loïc
Re: PDF - jump to named destination?
Hi Loïc,
Yes, I currently have the latest version with a demo license. I've looked through the API, but can't find out how to do this. I can see how to go to different pages within a PDF, or how to scroll through it, but not how to go to a named destination. Let's say my PDF has a destination defined with the name "section1". How would I navigate to that destination after loading the document. Something along these lines:
Yes, I currently have the latest version with a demo license. I've looked through the API, but can't find out how to do this. I can see how to go to different pages within a PDF, or how to scroll through it, but not how to go to a named destination. Let's say my PDF has a destination defined with the name "section1". How would I navigate to that destination after loading the document. Something along these lines:
Code: Select all
LicenseManager l = new LicenseManager();
l.RegisterKEY("...");
GdViewer viewer = new GdViewer();
viewer.DisplayFromFile("test.pdf");
/* viewer.GoToDestination("section1") <-- what goes here? */
Re: PDF - jump to named destination?
Hello,
In the GdViewer object, destination are reached by user interaction on annotations and bookmarks.
Doing what you need is possible by using the GdPicturePDF class that provides all functions to get information about destination target in the PDF. Se the Action section, particularly in the GetActionPageDestination() method description: https://www.gdpicture.com/guides/gdpicture/v9/html/con ... ingle.html
Let me know if you need further details.
With best regards,
Loïc
In the GdViewer object, destination are reached by user interaction on annotations and bookmarks.
Doing what you need is possible by using the GdPicturePDF class that provides all functions to get information about destination target in the PDF. Se the Action section, particularly in the GetActionPageDestination() method description: https://www.gdpicture.com/guides/gdpicture/v9/html/con ... ingle.html
Let me know if you need further details.
With best regards,
Loïc
Re: PDF - jump to named destination?
Okay, I'm getting closer now. It looks like what I need is to get the page number associated with a bookmark, so that I can tell the viewer to go to that page. Note that I only know the bookmark's name (maybe the same thing as title), not its integer ID. Looking through the GdPicturePDF class and GdViewer class, I don't see anything like this. Is there any way to do this? Thanks.
Re: PDF - jump to named destination?
Hello,
Could you clarify what you meant by " I don't see anything like this" ?
If you are trying to get the ID of a bookmark based on its name you have to parse the PDF outlines. Here an example:
Kind regards,
Loïc
Could you clarify what you meant by " I don't see anything like this" ?
If you are trying to get the ID of a bookmark based on its name you have to parse the PDF outlines. Here an example:
Code: Select all
Private Sub parseOutlines(ByVal oGdPicturePDF As GdPicturePDF, ByVal bookmarkID As Integer, ByVal level As Integer)
While True
MessageBox.Show("Title: " + oGdPicturePDF.GetBookMarkTitle(bookmarkID) + ". level: " + level.ToString())
'Check childs
If oGdPicturePDF.GetBookMarkChildCount(bookmarkID) > 0 Then
parseOutlines(oGdPicturePDF, oGdPicturePDF.GetBookMarkFirstChildID(bookmarkID), level + 1)
End If
'Check for subsequent outlines
bookmarkID = oGdPicturePDF.GetBookMarkNextID(bookmarkID)
If bookmarkID = 0 Then
Exit While
End If
End While
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using oGdPicturePDF As New GdPicturePDF
oGdPicturePDF.LoadFromFile("c:\outlines.pdf", False)
parseOutlines(oGdPicturePDF, oGdPicturePDF.GetBookMarkRootID(), 0)
End Using
End Sub
Loïc
Who is online
Users browsing this forum: Majestic-12 [Bot] and 2 guests