Write document metadata
metadata_writePatch a document's title, author, subject, and keywords without altering other metadata or the file format.
Instructions
Patches a document's own title/author/subject/keywords, leaving every other field and every other flag as-is. Does not convert format -- the source document's own format and targetFormat must match (or both be 'pdf'); odf (a standalone formula document) is rejected outright as either a source or a target, since it has no write path back out at all. Convert the document to a different format first (e.g. with a documents.js conversion tool) if metadata needs to be set on the result of a format change.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output | No | Where to write the patched document. Omit entirely to receive the bytes inline, base64-encoded. | |
| source | Yes | The document to patch metadata on. | |
| setTitle | No | Set the title field. Omit to leave it exactly as the source document already has it. | |
| setAuthor | No | Set the author field. Omit to leave it exactly as the source document already has it. | |
| setSubject | No | Set the subject field. Omit to leave it exactly as the source document already has it. | |
| setKeywords | No | Set the keywords field. Omit to leave it exactly as the source document already has it. | |
| targetFormat | Yes | The format to write the patched document back out as -- must match the source document's own format (or both be 'pdf'). metadata_write never converts format. |