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

Notification

Icon
Error

New Topic Post Reply
Options
Go to last post Go to first unread
pmilin  
#1 Posted : Tuesday, April 21, 2020 12:33:25 PM(UTC)
Quote
pmilin

Rank: Newbie

Groups: Registered
Joined: 4/21/2020(UTC)
Posts: 3
United States
Location: Fort Collins

When looking for named destinations in a pdf using the Document.NamedDestinations.GetByName() method, it takes a long time to return if the destination cannot be found. I have a doc with thousands of destinations. If the destination is found, it returns quickly.

Is there a better way to determine if the destination exists before getting it? Using the Item[String] property is slow as well.
Paul Rayman  
#2 Posted : Wednesday, April 22, 2020 6:04:07 AM(UTC)
Quote
Paul Rayman

Rank: Administration

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

Thanks: 3 times
Was thanked: 111 time(s) in 108 post(s)
Try this

Code:
IntPtr handle = Pdfium.FPDF_GetNamedDestByName(doc.Handle, name);
if (handle == IntPtr.Zero)
    //The named destination is absent.


pmilin  
#3 Posted : Wednesday, April 22, 2020 9:02:12 AM(UTC)
Quote
pmilin

Rank: Newbie

Groups: Registered
Joined: 4/21/2020(UTC)
Posts: 3
United States
Location: Fort Collins

Thanks. That seems to do the trick.

Is there a way to turn that handle into a destination.

Edited by user Wednesday, April 22, 2020 9:08:39 AM(UTC)  | Reason: Not specified

Paul Rayman  
#4 Posted : Wednesday, April 22, 2020 9:45:45 AM(UTC)
Quote
Paul Rayman

Rank: Administration

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

Thanks: 3 times
Was thanked: 111 time(s) in 108 post(s)
Originally Posted by: pmilin Go to Quoted Post

Is there a way to turn that handle into a destination.


Unfortunately, a suitable constructor has the Internal modifier. So only through Reflection.
pmilin  
#5 Posted : Wednesday, April 22, 2020 9:51:12 AM(UTC)
Quote
pmilin

Rank: Newbie

Groups: Registered
Joined: 4/21/2020(UTC)
Posts: 3
United States
Location: Fort Collins

Ok. No problem I can call the GetByName method afterward. I was just looking to optimize if possible.
Quick Reply Show Quick Reply
Users browsing this topic
New Topic Post Reply
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.