Hello,
Please read the information available on:
https://www.phpdocx.com/documentation/cookbook/repair-PDF
You need to use not protected documents or unprotect them.
If you need to handle the Exception, you just need to catch it:
try {
$merge->mergePdf(array('document1.pdf', 'document2.pdf'), 'output.pdf');
} catch (Exception $e) {
// handle the exception
}
Regards.