Hello,

I'm trying to prevent the users from copying content from pdf using the pdfbox 
with the following code:
File filePdf = fileService.addFileToDir(fileInBase64)
PDDocument pdd = PDDocument.load(filePdf)

AccessPermission ap = new AccessPermission()
ap.setCanExtractContent(false)
StandardProtectionPolicy stpp = new StandardProtectionPolicy(pdfLockPassword, 
"", ap)
stpp.setEncryptionKeyLength(128)
stpp.setPreferAES(true);
stpp.setPermissions(ap)
pdd.protect(stpp)

When opening the pdf file from Adobe Acrobat or Microsoft Edge, the copy 
shortcut doesn't work and therefore the content isn't copied. However, opening 
the file with Chrome and Opera is allowing the content to be copied using the 
shortcut.

I'm using the following version: org.apache.pdfbox:pdfbox:2.0.27.

Is there a way to fix this problem?

Best,
Daniela.

Reply via email to