This article is about importing a page extracted from a PDF file into a new PDF document.
The code runs with RadaeePDF SDK on Android and Server and it's written in Java.
/**
* Import a page from source document to destination document in the specified index.
*
* @param srcPath the path of the source document.
* @param srcPass the password of the source document.
* @param srcPage the number of the page to import from source document. (0 based page NO)
* @param destDoc the destination document object
* @param destPage the number of the page to import into. (0 based page NO)
* @return the imported page number
*/
public static int importPageInto(String srcPath, String srcPass, int srcPage, Document destDoc, int destPage) {
try {
Document mSrcDoc = new Document();
if(mSrcDoc.Open(srcPath, srcPass) == 0) {
ImportContext mContext = destDoc.ImportStart(mSrcDoc);
if(mContext != null) {
if(destDoc.ImportPage(mContext, srcPage, destPage)) {
destPage++;
}
mContext.Destroy();
}
}
mSrcDoc.Close();
} catch (Exception e) {
e.printStackTrace();
}
return destPage;
}
RadaeePDF SDK for Android, RadaeePDF Master SDK
Created : 2020-10-01 09:34:24, Last Modified : 2021-05-27 13:39:26