Skip to content

Commit 6bbb093

Browse files
committed
docs: document embedsMetadata form field and embed metadata engines flag
Assisted-by: Claude:claude-opus-4-7
1 parent 736898c commit 6bbb093

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

docs/_shared/_attachments_pdfengines.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import ApiEndpoint from "@site/src/components/documentation/ApiEndpoint";
22

33
Attach external files directly inside the PDF container. Commonly used for e-invoicing standards like **[ZUGFeRD / Factur-X](https://fnfe-mpe.org/factur-x/)**, which require a machine-readable XML invoice as an attachment.
44

5+
Provide per-attachment metadata with `embedsMetadata` to satisfy PDF/A-3 and Factur-X requirements: each entry sets the embedded file stream's `/Subtype`, writes `/AFRelationship` on the file specification, and references the attachment from the Document Catalog's `/AF` array.
6+
57
{(props.showFormFields || props.showCurlExample) && (
68

79
<ApiEndpoint
@@ -17,14 +19,28 @@ Attach external files directly inside the PDF container. Commonly used for e-inv
1719
]
1820
: undefined
1921
}
22+
formFields={
23+
props.showFormFields
24+
? [
25+
{
26+
name: "embedsMetadata",
27+
type: "json",
28+
defaultValue: "None",
29+
description:
30+
"Per-attachment metadata keyed by filename. Each entry accepts `mimeType` (written to the embedded file stream's `/Subtype`) and `relationship` (the `/AFRelationship` value, e.g., `Source`, `Data`, `Alternative`, `Supplement`, `Unspecified`). Requires a PDF engine that supports the feature (QPDF by default).",
31+
},
32+
]
33+
: undefined
34+
}
2035
curl={
2136
props.showCurlExample
2237
? `
2338
curl \\
2439
--request ${props.method} http://localhost:3000${props.path} \\
2540
${props.curlFormData}
26-
--form embeds=@invoice.xml \\
41+
--form embeds=@factur-x.xml \\
2742
--form embeds=@logo.png \\
43+
--form embedsMetadata='{"factur-x.xml":{"mimeType":"text/xml","relationship":"Alternative"},"logo.png":{"mimeType":"image/png","relationship":"Supplement"}}' \\
2844
${props.curlOutput}
2945
`
3046
: undefined

docs/configuration.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ The following flags allow you to configure the PDF Engines module:
257257
| <span class="badge badge--secondary">--pdfengines-read-metadata-engines</span> | <span class="badge badge--secondary">PDFENGINES_READ_METADATA_ENGINES</span> | Set the PDF engines and their order for the read metadata feature - empty means all. | exiftool |
258258
| <span class="badge badge--secondary">--pdfengines-write-metadata-engines</span> | <span class="badge badge--secondary">PDFENGINES_WRITE_METADATA_ENGINES</span> | Set the PDF engines and their order for the read metadata feature - empty means all. | exiftool |
259259
| <span class="badge badge--secondary">--pdfengines-encrypt-engines</span> | <span class="badge badge--secondary">PDFENGINES_ENCRYPT_ENGINES</span> | Set the PDF engines and their order for the password protection feature - empty means all. | qpdf,pdftk,pdfcpu |
260-
| <span class="badge badge--secondary">--pdfengines-embed-engines</span> | <span class="badge badge--secondary">PDFENGINES_EMBED_ENGINES</span> | Set the PDF engines and their order for the file embedding feature - empty means all. | pdfcpu |
260+
| <span class="badge badge--secondary">--pdfengines-embed-engines</span> | <span class="badge badge--secondary">PDFENGINES_EMBED_ENGINES</span> | Set the PDF engines and their order for the file embedding feature - empty means all. | qpdf,pdfcpu |
261+
| <span class="badge badge--secondary">--pdfengines-embed-metadata-engines</span> | <span class="badge badge--secondary">PDFENGINES_EMBED_METADATA_ENGINES</span> | Set the PDF engines and their order for the embed metadata feature - empty means all. | qpdf |
261262
| <span class="badge badge--secondary">--pdfengines-watermark-engines</span> | <span class="badge badge--secondary">PDFENGINES_WATERMARK_ENGINES</span> | Set the PDF engines and their order for the watermark feature - empty means all. | pdfcpu,pdftk |
262263
| <span class="badge badge--secondary">--pdfengines-stamp-engines</span> | <span class="badge badge--secondary">PDFENGINES_STAMP_ENGINES</span> | Set the PDF engines and their order for the stamp feature - empty means all. | pdfcpu,pdftk |
263264
| <span class="badge badge--secondary">--pdfengines-write-bookmarks-engines</span> | <span class="badge badge--secondary">PDFENGINES_WRITE_BOOKMARKS_ENGINES</span> | Set the PDF engines and their order for the write bookmarks feature - empty means all. | pdfcpu,pdftk |

docs/manipulate-pdfs/attachments.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import Sponsors from "@site/src/components/documentation/Sponsors";
88

99
Embeds external files directly inside the PDF container. Commonly used for e-invoicing standards like **[ZUGFeRD / Factur-X](https://fnfe-mpe.org/factur-x/)**, which require a machine-readable XML invoice as an attachment.
1010

11+
Provide per-attachment metadata with `embedsMetadata` to satisfy PDF/A-3 and Factur-X requirements: each entry sets the embedded file stream's `/Subtype`, writes `/AFRelationship` on the file specification, and references the attachment from the Document Catalog's `/AF` array.
12+
1113
<ApiEndpoint
1214
method="POST"
1315
path="/forms/pdfengines/embed"
@@ -41,11 +43,21 @@ Embeds external files directly inside the PDF container. Commonly used for e-inv
4143
description: "Files to embed (e.g., .xml, .png, etc.).",
4244
},
4345
]}
46+
formFields={[
47+
{
48+
name: "embedsMetadata",
49+
type: "json",
50+
defaultValue: "None",
51+
description:
52+
"Per-attachment metadata keyed by filename. Each entry accepts `mimeType` (written to the embedded file stream's `/Subtype`) and `relationship` (the `/AFRelationship` value, e.g., `Source`, `Data`, `Alternative`, `Supplement`, `Unspecified`). Requires a PDF engine that supports the feature (QPDF by default).",
53+
},
54+
]}
4455
curl={`
4556
curl \\
4657
--request POST http://localhost:3000/forms/pdfengines/embed \\
4758
--form files=@/path/to/invoice.pdf \\
4859
--form embeds=@/path/to/factur-x.xml \\
60+
--form embedsMetadata='{"factur-x.xml":{"mimeType":"text/xml","relationship":"Alternative"}}' \\
4961
-o my.pdf`}
5062
responses={[
5163
{

0 commit comments

Comments
 (0)