Hello Daniela,
So what you're saying is that Chrome and Opera aren't following the
restrictions. To find out whether the properties are set correctly, see
the security properties in Adobe Reader or Acrobat. The viewer software
is meant to follow these properties or they aren't following the standard.
The only "solutions" I can think of is either to mess around with the
/ToUnicode properties so that text extraction produces something wrong
(I don't know how, but I know some software does this), or to replace
the content with an image. Of course, users can still do OCR.
Tilman
On 05.01.2023 21:14, Daniela Alves wrote:
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.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org