I haven’t worked with copy restricted documents, but I use PDFBox to open and work with password protected documents. At first glance it looks like it might work for you (
http://stackoverflow.com/questions/14700241/remove-encryption-from-pdf-with-pdfbox-like-qpdf ). PDFBox also comes with a nice little utility class for merging PDFs, here’s an example of how to use it. Although I suspect you’ll have to preprocess the documents (removing access restrictions) before using the PDFMergerUtility.
public WOActionResults multipleInvoiceResponse() {
PDFMergerUtility list = new PDFMergerUtility();
list.addSource( new ByteArrayInputStream( pdfDocument1ByteArray ) );
list.addSource( new ByteArrayInputStream( pdfDocument2ByteArray ) );
list.addSource( /* etc… */ );
ByteArrayOutputStream out = new ByteArrayOutputStream();
list.setDestinationStream( out );
try {
list.mergeDocuments();
}
catch( COSVisitorException | IOException e ) {
throw new RuntimeException( "An exception occurred while attempting to merge multiple invoices”, e );
}
return USHTTPUtilities.responseWithDataAndMimeType( “invoices.pdf", out.toByteArray(), "application/pdf" );
}