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

Notification

Icon
Error

Options
Go to last post Go to first unread
Kazuhiro Tomita  
#1 Posted : Sunday, March 5, 2023 12:57:08 PM(UTC)
Kazuhiro Tomita

Rank: Newbie

Groups: Registered
Joined: 3/5/2023(UTC)
Posts: 4
Japan
Location: Tokyo

Thanks: 1 times
I am building an application to searchlink annotations in PDFs. When the action type of a certain link annotation is ExternalDoc, I want to get the information about destination. I could get the page number of the destination with "PdfGoToRAction.Destination.PageIndex" without any problem. However, I am not sure which file the page number is for. I have tried the following, but none of them worked.
-PdfGoToRAction.FileSpecification.FileName
-PdfGoToRAction.Dictionary.First.Value
-PdfGoToRAction.Destination.Array.Item
Link annotation can be set up multiple Actions, but there is no problem in the assumption that all link annotations have only one action. Can you please tell me how to do this? Thanks in advance.

Edited by user Friday, March 10, 2023 4:57:15 PM(UTC)  | Reason: Not specified

Paul Rayman  
#2 Posted : Monday, March 6, 2023 10:20:43 PM(UTC)
Paul Rayman

Rank: Administration

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

Thanks: 7 times
Was thanked: 128 time(s) in 125 post(s)
Hello,

Here are some examples of Goto-R action.
https://pdfium.patagames...l/WorkingSDK_Actions.htm
Kazuhiro Tomita  
#3 Posted : Friday, March 10, 2023 5:19:56 PM(UTC)
Kazuhiro Tomita

Rank: Newbie

Groups: Registered
Joined: 3/5/2023(UTC)
Posts: 4
Japan
Location: Tokyo

Thanks: 1 times
Hello. Thank you for your interest in my question. I saw those sample you showed me. Based on what is written on this page, PdfGoToRAction.FileSpecification.FileName should work, but it doesn't because PdfGoToRAction.FileSpecification is null. I have verified in Adobe Acrobat Pro that the link has another file as the target. Do you have any ideas to remedy the situation?

(VB.NET)
Dim CurrentLink As PdfLink
If CurrentLink.Action.ActionType = Enums.ActionTypes.ExternalDoc Then
Dim CurrentLinkAction As PdfGoToRAction = CurrentLink.Action
If CurrentLinkAction.FileSpecification IsNot Nothing Then
MessageBox.Show(CurrentLinkAction.FileSpecification.FileName)

Else
MessageBox.Show("I got this message")

End If

End If

(C#)
PdfLink CurrentLink;
if (CurrentLink.Action.ActionType == Enums.ActionTypes.ExternalDoc){
PdfGoToRAction CurrentLinkAction = CurrentLink.Action;
if (CurrentLinkAction.FileSpecification != null)
MessageBox.Show(CurrentLinkAction.FileSpecification.FileName);

else
MessageBox.Show("I got this message");

}

Originally Posted by: Paul Rayman Go to Quoted Post
Hello,

Here are some examples of Goto-R action.
https://pdfium.patagames...l/WorkingSDK_Actions.htm

Edited by user Friday, March 10, 2023 5:36:07 PM(UTC)  | Reason: Not specified

Paul Rayman  
#4 Posted : Friday, March 10, 2023 9:45:51 PM(UTC)
Paul Rayman

Rank: Administration

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

Thanks: 7 times
Was thanked: 128 time(s) in 125 post(s)
The file specification is a required field of the GotoR action. So if it's null where there are two options:
1. The document is damaged
2. This is something that really needs to be fixed in the SDK.

could you provide such a pdf file? I'm researching how it works.

Edited by user Friday, March 10, 2023 9:55:32 PM(UTC)  | Reason: Not specified

Kazuhiro Tomita  
#5 Posted : Tuesday, March 14, 2023 12:56:15 PM(UTC)
Kazuhiro Tomita

Rank: Newbie

Groups: Registered
Joined: 3/5/2023(UTC)
Posts: 4
Japan
Location: Tokyo

Thanks: 1 times
Thank you. It would be very helpful if you could investigate.

linktest.zip (135kb) downloaded 1 time(s).

Here is the link for the zip I uploaded to my server. Same as attached.

This zip contains two files, a c24 file and a c25 file. The c24 file has three links, all of which are external links to the c25 file. The ActionType for these links is ExternalDoc, but the FileSpecification is Null.

Edited by user Tuesday, March 14, 2023 1:07:50 PM(UTC)  | Reason: Not specified

Paul Rayman  
#6 Posted : Wednesday, March 15, 2023 4:28:51 AM(UTC)
Paul Rayman

Rank: Administration

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

Thanks: 7 times
Was thanked: 128 time(s) in 125 post(s)
Thank for the files provided.
Will be fixed in the next release.

Workaround for now:
Code:

using(var doc = PdfDocument.Load(@"e:\33\linktest\c24.pdf"))
{
    var link = doc.Pages[0].Annots[0] as PdfLinkAnnotation;
    var action = link.Link.Action as PdfGoToRAction;
    if (action.FileSpecification == null)
    {
        var fileName = action.Dictionary["F"].As<PdfTypeString>().UnicodeString;
    }
}

Edited by user Wednesday, March 15, 2023 4:30:04 AM(UTC)  | Reason: Not specified

Kazuhiro Tomita  
#7 Posted : Thursday, March 16, 2023 3:29:03 AM(UTC)
Kazuhiro Tomita

Rank: Newbie

Groups: Registered
Joined: 3/5/2023(UTC)
Posts: 4
Japan
Location: Tokyo

Thanks: 1 times
thank you. I got the file name I wanted with the method you showed me. I'm happy. It would be even better if FileSpecification is not null in future version upgrades.
Paul Rayman  
#8 Posted : Saturday, March 18, 2023 2:06:58 AM(UTC)
Paul Rayman

Rank: Administration

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

Thanks: 7 times
Was thanked: 128 time(s) in 125 post(s)
thanks 1 user thanked Paul Rayman for this useful post.
Kazuhiro Tomita on 4/8/2023(UTC)
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.