Unable to catch error when embedding protected PDF

When applying an existing PDF as a background resource I encountered the error

“Unable to handle secure document … content copying is not allowed”

Upon some research the error is expected and there is nothing to do, however the process does not interrupts and produces a document with a blank page.


It’s imperative to catch this error and interrupt processing, below my attempts to catch the error and throw a fatalError to interrupt the process, however neither the resource() nor the try catch around the .addAfter works.

Can you please open a protected PDF in Adobe Acrobat (Reader), go to MenuDocument PropertiesDocument Properties window, make a screenshot of the information shown in the Security tab and share this screenshot here?

The reason why I am asking is because I am curious what security settings the protected PDF has.

Sure, right away

According to the documentation there are also some permissions fields, but I see that they are not initialized properly in this scenario. I’ll create a ticket for that.

1 Like

I added the printingAllowed check, it returns unknown for the PDF attached in the previous reply.

OLConnect 2024.1.2

Right, that is why I created that ticket. permissions.hasPassword also does not have the right value, we should definitely fix that.

You don’t need the permissions fields though. Just check the width and height like in the code I posted.

1 Like

Tip: As for the statement if (resource(resourceUrl)) {}; please note that this can be used this way when you would like to check if a file exists.