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

Free Support Forum - aspose.com

Link to embedded files

Hello everybody,

This post is linked to the last one that I created (https://forum.aspose.com/t/64727) but as my need changed I create this new one.

I want to know if is it possible to create a link to an embedded file with Aspose.PDF ?

The idea is to reproduce the behavior of the OLE object in Word (clic on the OLE icon -> open the coresponding embedded file).

Currently, I’m able to :

  1. Extract all OLE files from my Word file (and save them on my disk)
  2. Convert my Word file into PDF (here the OLE files are lost, just OLE icons are preserved)
  3. Reintroduce all OLE files (saved in step 1.) into my PDF as embedded files

But after that, I don’t know how to create a link between the OLE icons and the embedded files.

PS : You can find in attachments my input Word file and my output PDF.

Thank you for your help.


Hi Gerald,

Thanks for your inquiry. Please check following code snippet to create internal link to embedded files. Hopefully it will help you to acomplish the task.

Document doc = new Document(myDir+"input.pdf");
FileAttachmentAnnotation fileAttachment = new FileAttachmentAnnotation(doc.Pages[1], newRectangle(0, 0, 16, 16), doc.EmbeddedFiles[1]);
fileAttachment.Title = "Attached file";

Please feel free to contact us for any further assistance.

Best Regards,

Hello Tilal,

Thank you for your answer.

Using FileAttachmentAnnotation and some tricks, I got to produce a PDF corresponding at 100% to my need (same behavior as Word for the OLE object).

I can’t post here my code for some “properties restrictions” reasons but I can share you the algorithm :

  1. Extract all OLE (NodeType.Shape) from the Word file, save them on the disk and add a link to the saved files on yours Shapes (Shape.HRef) (1st trick)
  2. Convert the Word file into PDF. Here, the OLE files are lost, just OLE icons are preserved with links to the saved files
  3. Post-process the PDF file by looping to the LinkAnnotations and create a FileAttachmentAnnotation with the same Rectangle as the LinkAnnotaton ones (2nd trick) and the LinkAnnotation URI. Set FileAttachmentAnnotation.Opacity to “0.0” (3rd trick) and add it to your page.

I hope that this algorithm will help people.

You can find in attachement the PDF result.

If is there another “cleaner” way to get the same result, please tell me.


Hi Gerald,

Thanks for your feedback and sharing workflow for accomplishing the task.Definitely, it will help any other community member having similar requirements.

Moreover, AFAIK you followed the optimal path for the scenario.

Best Regards,