Knowledge Base - Attach file to a PDF

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;
}
Applies To

RadaeePDF SDK for Android, RadaeePDF Master SDK

Details

Created : 2020-10-01 09:02:44, Last Modified : 2021-05-27 13:41:08