We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Adding Hyperlink for embedded attachment

Hi,

I am trying to add an attachment to a PDF and give a hyperlink to that attachment in particular page at particular position. I was able to add attachment but I am not able to give hyperlink to that attachment. I am using Aspose.PDF java APIs.

Can you please help me in adding a hyperlink to embedded attachment?

Thanks,
Bhaskar

@bhaskarsami

Thank you for contacting support.

We have already logged a feature request as PDFNET-40886 in our issue tracking system. We have linked your post with the ticket ID as well, so that you will receive notification once the feature is available. Furthermore, you may please use FileAttachmentAnnotation in order to provide a link to embedded file(s) inside PDF, while using following code snippet:

com.aspose.pdf.Document pdfDocument = new Document(dataDir + "FileWithAttachment.pdf");
Page pdfPage = pdfDocument.getPages().get_Item(1);
FileAttachmentAnnotation fileAttachment = new FileAttachmentAnnotation(pdfPage, new Aspose.Pdf.Rectangle(0, 0, 16, 16), pdfDocument.EmbeddedFiles[1]);
fileAttachment.setRect(new Rectangle(100, 100, 120, 120));
fileAttachment.setIcon(FileIcon.Paperclip);
fileAttachment.setTitle("Attached file");
fileAttachment.setContents("Attached file");
pdfDocument.getPages().get_Item(1).getAnnotations().add(fileAttachment);
pdfDocument.save(dataDir + "LinktoFileWithAttachment.pdf");

Concerning to the logged feature request, we will surely let you know once we make any significant progress towards its availability. Please spare us little time.

We are sorry for the inconvenience.

Thanks a lot for your support and quick response!!!

For now, we can proceed with the mentioned approach. Is there a way I can provide the custom icon instead of given FileIcons. Actually, we wanted to upload an excel sheet to the PDF and none of the given icons suitable for us.

Thanks,
Bhaskar

@bhaskarsami

Thank you for your kind feedback.

We are glad to know that suggested approach worked fine in your environment. About custom attachment icon, a feature request ticket with ID PDFNET-40484 is already logged in our issue management system. The ticket ID has been linked with this thread so that you will receive notification as soon as the feature will be supported.

@Farhan.Raza

Thanks a lot for the response!!!

It would be great if you can provide the timeline by which the enhancement will be available for the ticket# PDFNET-40484. Just to inform you that we are expecting the fix in java.

Thanks,
Bhaskar

@bhaskarsami

We are afraid an ETA may not be available before the ticket is investigated in our environment. We have recorded your request and will let you know as soon as the ETA will be available. Moreover, this feature will be included in .NET version and then will be auto ported to Java version. We appreciate your patience and comprehension in this regard.

Hi,
Was there any progress made on this the ticket mentioned in this thread. We have exact same requirement, I was wondering if a solution was provided for mentioned tickets.

@cipher

Regretfully, the ticket are not yet resolved. We have recorded your concerns and will surely inform you as soon as we have some definite updates regarding their resolution. Please spare us some time.

We are sorry for the inconvenience.