Skip to content

PdfMetadata::GetKeywords returns incorrect list of keywords #318

@ddelemeny

Description

@ddelemeny
  • What is the current behavior?
    PdfMetadata::GetKeywords returns a different list of keywords than the one set by PdfMetadata::SetKeywords.

  • What is the expected behavior?
    It should return the same list.

  • Please provide the steps to reproduce and if possible a minimal reproduction code of the problem

    • Create a document
    • Set a list of keywords on the metadata object
    • Get the list of keywords back and compare. Separator characters will have bled into list items.
        auto doc = new PoDoFo::PdfMemDocument();
        std::vector<std::string> keywords = {"one", "two", "three"};
        doc->GetMetadata().SetKeywords(keywords);
        if(keywords != doc->GetMetadata().GetKeywords()) {
            throw std::runtime_error("Keyword mismatch. " + std::string(doc->GetMetadata().GetKeywordsRaw()->GetString()));
        };
  • Please tell us about your environment:

    • Version 1.0.3
    • Operating System: Linux 64 bits (likely all)
    • Package manager used: conan
  • Other information

The keyword parser implementation at https://github.com/podofo/podofo/blob/master/src/podofo/private/PdfDeclarationsPrivate.cpp#L294 looks like it consumes the separator \r\n incorrectly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions