Skip to main content
Version: 9.x

Remove an attachment

Removes a file embedded in a PDF.

POST/forms/pdf/detach
filesfile[]required

The PDFs.

archivesfile[]

ZIP files Gotenberg unpacks: each entry counts as a file uploaded under files.

URLs Gotenberg downloads first, as if you had uploaded the files. Each entry takes a url, and optionally extraHttpHeaders.

namestringrequired

The name the PDF lists the file under. /forms/pdf/attachments lists them; a name it doesn't list answers 400.

The PDF, or a ZIP of the PDFs when you send several.

The route also takes the headers. An error answers a status and a message: see Errors.

curl \
--request POST http://localhost:3000/forms/pdf/detach \
--form files=@invoice.pdf \
--form name=factur-x.xml \
-o invoice.pdf

name is the name /forms/pdf/attachments lists. A name the PDF doesn't list answers 400, with the names it does list.

In a list of stages​

The stage also runs in a list on /forms/pdf/pipe, and on the PDFs a Chromium or LibreOffice conversion makes, in its stages field:

curl \
--request POST http://localhost:3000/forms/pdf/pipe \
--form files=@invoice.pdf \
--form 'stages=[
{ "op": "detach", "name": "factur-x.xml" }
]' \
-o invoice.pdf