Home Features Download Tutorial Version History License PDF Mosaic Blog Source Code
You can attach PDFs and other types of files to a PDF. If you move the PDF to a new location, the attachments move with it. Attachments may include links to or from the parent document or links to other attachments.
For the file attachments, you have an option of opening or saving the file. Opening the file starts the application that handles the file format of the attachment. (You must have that application to open the attachment.)
Note: Acrobat does not open EXE, VBS, and ZIP file formats because these formats are associated with malicious programs, macros, and viruses that can damage your computer.
This sample shows how to add File Attachment annotations to your PDF document. Use PDFTextAnnotation class to add File Attachment annotation.
C# :
using PDFMosaic; using System; namespace FileAttachment { class FileAttachment { static void Main(string[] args) { 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); } } }
Visual Basic :
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
Home Features Download Tutorial Version History License PDF Mosaic Blog Source Code