PDF metadata
A PDF has a title, an author, a subject and keywords inside it, and a headless render leaves all four blank. The metadata object fills them on the same POST, so the file introduces itself in every reader, tab and print dialog.
Why rendered PDFs come out nameless
Chromium prints the page; it does not interpret the page's meaning. The document's <title> becomes the suggested filename in a headed browser, but the PDF's info dictionary is left empty, and so are the other three fields. The result is a file that shows up as document.pdf in a mail attachment list and as nothing at all in a reader's title bar, no matter how carefully the HTML was written.
Most toolchains fix this after the fact with a separate library and a second pass over the bytes. Here it is a request field, applied in the same render that produced the file.
The four fields
All four are optional and independent. Send only the ones the document can honestly claim.
| Field | Type | Shown by readers as |
|---|---|---|
title | string, at most 300 characters | The document name in the title bar, the tab, and most attachment previews |
author | string, at most 300 characters | The Authors column in a library view |
subject | string, at most 300 characters | The description line under the title in a properties panel |
keywords | array of at most 20 strings, 60 characters each | The Keywords field search indexes and archive tools read |
Any other key in the object is refused with a 422 that names it, so a typo cannot silently produce an untitled document.
The call
curl -X POST https://webcapture.io/v1/convert \
-H "Authorization: Bearer wc_your_key" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/reports/q4",
"metadata": {"title": "Q4 revenue report",
"author": "Finance",
"subject": "Quarterly close, draft 3",
"keywords": ["revenue", "q4", "draft"]}}'
Metadata is a PDF-only field. A PNG or a markdown extraction has no info dictionary, so the field is refused rather than dropped. It is written after the watermark stamp and before encryption, which is why it is still visible in an encrypted document: the encryption wraps the finished bytes.
What metadata is not
It is not a security control and not a ranking trick. The fields are world-readable and easy to strip, so never put anything in them you would not print on the cover. What they buy is the ordinary thing: a file that says what it is, in the places people look before opening it.
If the document needs protecting as well, pair it with encryption in the same request. If it needs a visible mark, that is the watermark stamp.
Frequently asked questions
Does setting the PDF title change the HTML page title?
No. The page's own title tag is what Chromium prints and what a browser tab shows for the source page. metadata.title is written into the PDF's info dictionary after the render, so it only affects the document.
Can I read metadata back from the finished file?
Yes, with any PDF library: the four fields are standard info-dictionary entries, not a private extension. They survive normal viewers, print-to-file, and re-saving, though some editors replace them with their own producer string.
Why did my keywords get refused?
The cap is 20 entries of 60 characters each. Longer lists are rejected with a 422 that names the field, on the principle that a silently truncated keyword list is worse than an error.
Related
Render your first page in seconds
Mint a key, POST a URL, and the finished document comes back in the same response; pass ?wait=false for a job ticket with poll and download URLs. The first 50 renders a month are free, and there is no credit card. Not ready for a key? The free URL to PDF tool renders public pages without one.