Attachments
A PDF can carry other files inside it, such as the data behind a report or the source of a contract. Viewers list them in an attachments panel.
POST https://api.pdfdispatch.com/v1/pdf/attachments
Form fields
| Field | Type | Default | What it does |
|---|---|---|---|
files required | file(s) | – | The PDFs to attach to. |
embeds required | file(s) | – | The files to attach, as file parts named embeds. Their file names are kept. |
embedsMetadata | JSON object | – | Per attached file name: mimeType and relationship (Source, Data, Alternative, Supplement or Unspecified), which PDF/A-3 and e-invoices use. Example: {"data.csv": {"mimeType": "text/csv", "relationship": "Data"}}. |
embeds and embedsMetadata work on every conversion route too.
Example
curl --fail-with-body \
--header "Authorization: Bearer $PDD_KEY" \
--form files=@report.pdf \
--form embeds=@data.csv \
--form embeds=@chart-source.xlsx \
--form 'embedsMetadata={"data.csv": {"mimeType": "text/csv", "relationship": "Data"}}' \
--output report-with-data.pdf \
https://api.pdfdispatch.com/v1/pdf/attachments
For an archive-grade PDF with attachments, ask for pdfa=PDF/A-3b in the same request: PDF/A-1 and PDF/A-2 do not
allow attachments and are refused. For e-invoices, use Factur-X, which sets everything up.