Free Support Forum - aspose.com

Add attachment

Hi, i am trying to open a pdf file and add an attachment at a specific location i.e. text location. Is that possible?

Hi Pooja,


Thanks for your interest in our products.

Aspose.Pdf for .NET supports the feature to add attachments to PDF file over a specific location. Now concerning to your requirement on adding attachment on some text location, first you can get the location of text string and then attach/place the attachment on that location. Please visit the following link for more information on


[C#]

PdfContentEditor editor = new
PdfContentEditor();<o:p></o:p>

editor.BindPdf("example.pdf");

using (System.IO.FileStream attStream = System.IO.File.OpenRead("attachment_file.pdf"))

{

editor.CreateFileAttachment(new System.Drawing.Rectangle(0, 0, 100, 100),

"Welcome to Aspose", attStream, "attachment_file.pdf", 1, "Graph");

editor.Save("example_out.pdf");

}


In the event of any further query, please feel free to contact.