Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetKeyword() produces garbled property when document is encrypted #72

Open
lordofscripts opened this issue May 6, 2024 · 0 comments
Open

Comments

@lordofscripts
Copy link

The following code:

pdf.SetKeywords("one two three", true)

Does not produce any error. However, when viewing the document and opening its properties, it shows a garbled string regardless of whether the last argument is true or false. In GO all strings are UTF8.

The same occurs with pdf.SetSubject() and pdf.SetTitle().

However, that only happens when pdf.SetProtection(fpdf.CnProtectPrint) is used. In that case even after the reader has entered the correct password, only the document content is decrypted but the document properties remain encrypted.

If on the other hand no protection is used during generation, the document properties are plain text and readable.

Fix:

  • After the correct password is entered, decrypt both content & properties.
  • Alternatively, don't encrypt document properties.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant