Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

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

@lordofscripts

Description

@lordofscripts

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions