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

Free Support Forum - aspose.com

Generating PDF with files as attachment

Hi @

I have a requirement in which files should be displayed as attachments in the PDF generated. Also on click of attachment the actual file should be opened.

Please let us know if this is achievable with any of the aspose components.

Please provide us sample code if any.

Hi,



For your query, I will move it to Aspose.Pdf forum, Aspose.Pdf team would help you soon.



Thank you.

Hello Aneesh,

Thanks for using our products.

Please visit the following link for required information. Working with Attachments & Annotations

In case you have any further query, please feel free to contact.

Hi @,

Could you please let me know how to show an attachment icon as word symbol when we attach word file.

Thanks,

Aneesh

Hi Aneesh,

I’m sorry to inform you that currently you can’t show Word symbol as attachment icon. At the moment, you can only show the icons given in the FileIconType enumeration.

We’re sorry for the inconvenience. If you have any further questions, please do let us know.
Regards,

Hi Shahzad,

Can we show any image as an icon and on click of that image open the files at specified location.

Thanks and Regards

Aneesh.

Hello Aneesh,

Please try using the following code snippet to accomplish your requirement.

[C#]

//Instantiate a pdf document
Pdf pdf1 = new Pdf();
//Create a section in the Pdf object
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();

Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
//Set the path of image file
image1.ImageInfo.File = "d:/pdftest/Aspose.jpg";
//Set the type of image using ImageFileType enumeration
image1.ImageInfo.ImageFileType = ImageFileType.Jpeg;
//Assign a new instance of hyperlink to hyperlink property of segment
image1.Hyperlink = new Aspose.Pdf.Hyperlink();
//Set the link type of the text segment to File
image1.Hyperlink.LinkType = HyperlinkType.File;
//Set the path of the external Non-Pdf file
image1.Hyperlink.LinkFile = "d:/pdftest/SoftCoTest.docx";

//Add image object into the Paragraphs collection of the section
sec1.Paragraphs.Add(image1);
//Save the pdf document
pdf1.Save(@"D:\pdftest\Icon_Hyperlink.pdf");

In case it does not satisfy your requirement or you have any further query, please feel free to contact.