This sample shows how to add file attachment annotations to your PDF document.
C# :
using PDFMosaic;
using System;
namespace FileAttachment
{
class FileAttachment
{
static void Main()
{
PDFDocument document = new PDFDocument();
PDFPage page = new PDFPage(PDFPaperFormat.A4);
PDFFileAttachmentAnnotation fileAttachment = new PDFFileAttachmentAnnotation("..\\..\\two_pilots.bmp", 20, 40, 15, 15);
fileAttachment.Icon = PDFFileAttachmentAnnotationIcon.PushPin;
page.Annotations.Add(fileAttachment);
document.PageMode = PDFPageMode.Attachment;
document.Pages.Add(page);
document.Save("FileAttachment.pdf", true);
}
}
}
VB.NET :
Imports PDFMosaic
Imports System
Module FileAttachment
Sub Main()
Dim document As New PDFDocument()
Dim page As New PDFPage(PDFPaperFormat.A4)
Dim fileAttachment As New PDFFileAttachmentAnnotation("..\\..\\two_pilots.bmp", 20, 40, 15, 15)
fileAttachment.Icon = PDFFileAttachmentAnnotationIcon.PushPin
page.Annotations.Add(fileAttachment)
document.PageMode = PDFPageMode.Attachment
document.Pages.Add(page)
document.Save("FileAttachment.pdf", True)
End Sub
End Module