Free Support Forum -

Multiple Links to Embedded Files

Hello Aspose,

I’m evaluating Aspose.Pdf.

I have an existing pdf file generated by Aspose.Words. The pdf file contains sentences such as;

"Please refer to Some Legal 2009.docx, page 10 and Another Legal 2006.docx, page 4, for details blah blah blah"

What I would like to do is add the documents as an attachment (easy using FileSpecification) and then somehow have a link (icon or hyperlinked text) where the document is referenced, so readers can open the document without having to go to the attachments tab in Adobe Reader.

I know I can get the referenced document text co-ordinates by using TextFragmentAbsorber and TextFragment.

I have looked at the Attachment class, but this seems to add the attachment each time it is used, whereas I want to add, say a 100 attachments, and refer to them (link) in a 1000 places.

Any ideas ?

Regards, Paul

Hello Paul,

Thanks for using our products.

In order to create hyperlinks towards PDF documents, you may try using CreatePdfDocumentLink(...) method of PdfContentEditor class to create hyperlink to documents (including PDF) placed over your system. The simplest way to create hyperlink is specified in following code snippet but I am afraid, in recent release version of Aspose.Pdf for .NET 6.1.0, an issue is occurring when calling this method. For the sake of correction, I have logged this issue as PDFNEWNET-30017 in our issue tracking system. We will further look into the details of this problem and will try our level best to get this fixed, ASAP. Please be patient and spare us little time. We apologize for your inconvenience.

For further information over this topic, please visit Create PDF Document Link in an Existing PDF File (Facades)


//open document
PdfContentEditor contentEditor = new PdfContentEditor();
// bind the source PDF file

// specify the rectangular area for hyperlink
System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(100, 100, 120,110);
//create application link
contentEditor.CreatePdfDocumentLink(rectangle, @"d:/pdftest/29444.pdf", 1, 1);
// add free text representing Hyperlink over page 1
contentEditor.CreateFreeText(rectangle, "Sample Hyperlink",1);
// place a link in page 3 of source PDF file
contentEditor.CreatePdfDocumentLink(rectangle, @"d:/pdftest/29444.pdf", 3,1);
// add free text representing Hyperlink over page 3
contentEditor.CreateFreeText(rectangle, "Sample Hyperlink", 3);

// save the copy of updated document

The issues you have found earlier (filed as 30017) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan