Duplicate embedding of attachment

Document pdfDocument = new Document();
pdfDocument.Pages.Add();
Page pdfPage = pdfDocument.Pages[1];
Aspose.Pdf.FloatingBox floatBox = new Aspose.Pdf.FloatingBox(100, 50);
floatBox.Padding.Left = 965;
floatBox.Padding.Top = 553;
Aspose.Pdf.Text.TextFragment fragment = new TextFragment("Inline Text");
floatBox.Paragraphs.Add(fragment);
pdfPage.Paragraphs.Add(floatBox);
FileStream fs = new FileStream("C:\\Sample.docx", FileMode.Open);
FileSpecification fileSpecification = new FileSpecification(fs, "Sample.docx", "Testing");
pdfDocument.EmbeddedFiles.Add(fileSpecification);
FileAttachmentAnnotation fileAttachment = new FileAttachmentAnnotation(pdfPage,
new Aspose.Pdf.Rectangle(240, 210, 256, 226), pdfDocument.EmbeddedFiles[1]);
fileAttachment.Icon = FileIcon.Paperclip;
pdfDocument.Pages[1].Annotations.Add(fileAttachment);
const string fullpath = "C:\\pdftest\\Test.pdf";
pdfDocument.Save(fullpath);

System.Diagnostics.Process.Start(fullpath);


from the above sample code the generated pdf contains Sample.docx embedded twice in the attachment tab why?

and why the sixe of text("Inline Text") and clip icon("Paperclip") differs?
John 3:
Document pdfDocument = new Document();
pdfDocument.Pages.Add();
Page pdfPage = pdfDocument.Pages[1];
Aspose.Pdf.FloatingBox floatBox = new Aspose.Pdf.FloatingBox(100, 50);
floatBox.Padding.Left = 965;
floatBox.Padding.Top = 553;
Aspose.Pdf.Text.TextFragment fragment = new TextFragment("Inline Text");
floatBox.Paragraphs.Add(fragment);
pdfPage.Paragraphs.Add(floatBox);
FileStream fs = new FileStream("C:\\Sample.docx", FileMode.Open);
FileSpecification fileSpecification = new FileSpecification(fs, "Sample.docx", "Testing");
pdfDocument.EmbeddedFiles.Add(fileSpecification);
FileAttachmentAnnotation fileAttachment = new FileAttachmentAnnotation(pdfPage,
new Aspose.Pdf.Rectangle(240, 210, 256, 226), pdfDocument.EmbeddedFiles[1]);
fileAttachment.Icon = FileIcon.Paperclip;
pdfDocument.Pages[1].Annotations.Add(fileAttachment);
const string fullpath = "C:\\pdftest\\Test.pdf";
pdfDocument.Save(fullpath);

System.Diagnostics.Process.Start(fullpath);


from the above sample code the generated pdf contains Sample.docx embedded twice in the attachment tab why?
Hi John,

Please take a look over my comments in my post 654529 in your other forum thread.

John 3:
and why the sixe of text("Inline Text") and clip icon("Paperclip") differs?
I am afraid I am unable to understand your query. Can you please share some further details.

PS, do you mean the X Axis of both objects ?

the size of the paper clip seems to larger then the text

Hi John,


Thanks for your inquiry. Actually Rectangle parameter controls the FileAttachmentAnnotation icon size. So please adjust it as per your requirements.

…<o:p></o:p>

....

FileAttachmentAnnotation fileAttachment = new FileAttachmentAnnotation(pdfPage, new Aspose.Pdf.Rectangle(240, 210, 246, 216), fileSpecification);

....

....


Please feel free to contact us for any further assistance.


Best Regards,