Viktor S.
Viktor S.

Reputation: 12815

FileAttachment annotations in PDF: few annotations to the same file

I'm trying to add FileAttachment annotations to my PDF document using iTextSharp. In general, task is to add attachments (attachment types could be different - images, pdf, txt, doc etc.) to a file and create links to those files in different places of the document. Problem is that I can't figure out how I can add few annotations to the same file without having duplicates in Attachments tab (that one with paperclip icon) when document is opened in Adobe Reader.

Right now I'm able to position annotations where those should be, but in that case I have one phisical file in my document and multiple duplicates in attachments tab.

Another thing I can do is to add annotations to multiple pages without duplicates, but in this case I can't position annotation number 2, 3 and so on. They always keep the same position as the first annotation.

Another option I've been trying is GoToE(mbedded) action. But annotations with such actions does not work. This is a structure of action I've tried to build:

1 0 obj
<< /Type /Action
   /S /GoToE
   /T << /R /C
         /N (Embedded document) >>

Basically, there is no difference for me how my task will be implemented. The only requirement - no JS in document. If someone have some solution - please help.

With regards Viktor

Upvotes: 1

Views: 619

Answers (1)

Viktor S.
Viktor S.

Reputation: 12815

I've found that there is no solution without JS. FileAttachment annotation will always produce an entry in Attachments tab, but there is a way to use annotation with JavaScript action like this:

this.exportDataObject({cName:"[attached_file_name_here]", nLaunch:2});

This also works with bookmarks just fine. And for me it is a luck that I made mistake thinking that I can't use JS in documents where I need this feature.

Upvotes: 0

Related Questions