Frequently Asked Question

Attach file to a PDF
Last Updated 11 months ago

Using the following code you can attach a file to a PDF.

The file is attached at document level.

With the Master Edition you may remove files embedded in your PDF.

The code runs with RadaeePDF SDK on Android and Server and it's written in Java.

/**
 * Add a file as an attachment to PDF.
 * 
 * @param filePath PDF file path
 * @param attachmentPath the path of the file to be attached
 * @return true in case of success, false otherwise
 */
 public static boolean addFileAttachment(String filePath, String attachmentPath) {
     //init the library and activate the license
     Global.Init(key);
     Document Document = new Document();
     Document.Open(filePath, "");
     //add the attachment
     if(Document.NewEmbedFile(attachmentPath)) 
         return Document.Save();
     else 
         return false; 
 }

Loading ...