Skip to content

Embedpdf/feature/catalog metadata - #91

Merged
bobsingor merged 4 commits into
embedpdf/mainfrom
embedpdf/feature/catalog-metadata
Oct 28, 2026
Merged

bobsingor merged 4 commits into
embedpdf/mainfrom
embedpdf/feature/catalog-metadata

Conversation

@bobsingor

Copy link
Copy Markdown
Contributor

No description provided.

EPDFCatalog_GetMetadata returns the document's XMP packet, decoded.
EPDFCatalog_SetMetadata replaces its bytes, unfiltered and marked
/Type /Metadata /Subtype /XML so a save leaves them uncompressed, keeping
the stream's object number; a catalog without one gets a new stream, and
NULL removes /Metadata. What the packet says is the engine's to read and
write: the fork moves the bytes.
A save writes the metadata stream unencoded, so XMP readers find it in the
file's bytes. Upstream's CPDF_FlateEncoder decoded such a stream, then wrote
its encoded bytes without the /Filter that decodes them, so a rewrite turned
a compressed or hex-encoded packet into noise. It now writes the decoded
bytes, without /Filter and /DecodeParms; bytes that don't decode are written
as they are, filter and all.
Upstream's CPDF_Stream::WriteTo never encrypted a /Type /Metadata stream,
while the file's /EncryptMetadata (true unless it says false) tells readers
to decrypt it. A save of an encrypted file, rewrite or incremental, wrote its
XMP in the clear and every reader decrypted it into noise. The metadata
stream is now encrypted like any other; the creator gives no encryptor only
to the document's metadata stream of a file that keeps it in the clear,
which is the one the parser doesn't decrypt.
@bobsingor
bobsingor merged commit 2c1490a into embedpdf/main Oct 28, 2026
1 check passed
@bobsingor
bobsingor deleted the embedpdf/feature/catalog-metadata branch October 28, 2026 13:45
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

Successfully merging this pull request may close these issues.

1 participant