Creating a document based on another document

The following code example creates a com.adobe.idp.Document object that is based on another com.adobe.idp.Document object.

Creating a Document object that is based on another document

//Create a Document object based on a byte array 
InputStream is = new FileInputStream("C:\\Map.pdf"); 
int len = is.available(); 
byte [] myByteArray = new byte[len]; 
int i = 0; 
while (i < len) { 
      i += is.read(myByteArray, i, len); 
} 
Document myPDFDocument = new Document(myByteArray); 
 
//Create another Document object 
Document anotherDocument = new Document(myPDFDocument);