Patagames Software Support Forum
»
Tesseract.Net SDK
»
Common Questions
»
How to get the destination file name of a externaldoc link annotation?
Rank: Newbie
Groups: Registered
Joined: 3/5/2023(UTC) Posts: 4 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
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,104
Thanks: 7 times Was thanked: 129 time(s) in 126 post(s)
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/5/2023(UTC) Posts: 4 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 Edited by user Friday, March 10, 2023 5:36:07 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,104
Thanks: 7 times Was thanked: 129 time(s) in 126 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
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/5/2023(UTC) Posts: 4 Location: Tokyo Thanks: 1 times
|
Thank you. It would be very helpful if you could investigate. linktest.zip (135kb) downloaded 3 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
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,104
Thanks: 7 times Was thanked: 129 time(s) in 126 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
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/5/2023(UTC) Posts: 4 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.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,104
Thanks: 7 times Was thanked: 129 time(s) in 126 post(s)
|
|
1 user thanked Paul Rayman for this useful post.
|
|
|
Patagames Software Support Forum
»
Tesseract.Net SDK
»
Common Questions
»
How to get the destination file name of a externaldoc link annotation?
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.
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