How Far a Supplied PDF Is Allowed to Unpack
Set the ceiling one stream of a PDF you send may unpack to, so that a file built to swallow the machine is refused before it takes the room.
See It in a Real PDF
An Agreement Received and Added to without a Byte Moved
A maintenance agreement somebody else sent, with a signature area, a date and a line of one's own laid over its last page, an annex added after it and an empty place to sign over the signature area, every byte of the agreement left where it was.
Summary
When you send a PDF along — a letterhead to print onto, or a page to place — that file is compressed, the way a zipped folder is. A compressed file can be built so that a very small parcel unpacks into something enormous, and a program that unpacks it without looking fills the machine and stops. Raise the ceiling, up to a gibibyte, if you knowingly send very large pages; lower it if you accept files from people you do not know.
Technically
Written at the top level of a request, under
"supplied_pdfs"
supplied_pdfs settles how the PDFs supplied alongside the request are read: the templates the pages are stamped onto, the pages the items place, and the source the document opens on. expansion_limit is the ceiling one stream of such a file may decompress to. The check happens before the room is taken, not after: a file carrying a stream that asks for more is refused outright, so a small parcel built to unpack into gigabytes never gets the chance. Absent, the ceiling is the one the library reads a file at. add_to names one of those files as the document the rendered pages are added to, in a section appended after its last byte.
Request Schema
-
supplied_pdfs— object, optional. -
supplied_pdfs.expansion_limit— integer, optional, a number of bytes, at most 1 073 741 824. The most one stream of a supplied PDF may decompress to. Absent, the library's own ceiling holds, which is 268 435 456. A request naming more than the maximum is refused with a 400, and no PDF is read. -
supplied_pdfs.add_to— object, optional. The supplied PDF the rendered pages are added to, rather than handed back as a document of their own. The answer is that file, every byte of it where it was, followed by a section holding what was added: a signature already in it still covers what it covered, and a reader that shows the file's earlier versions still shows the one that arrived. -
supplied_pdfs.add_to.pdf— string, required. The name of the part holding the PDF. -
supplied_pdfs.add_to.over— array of one-based integers, optional, empty by default. For the first rendered pages in order, the page of the supplied PDF each is laid over, from the lower left corner of its sheet. Every rendered page past those is added after the supplied PDF's last page, in the order the render made them. -
A
signature_fieldbesideadd_tois added to the page its rendered page lands on, moved with that page onto the sheet it is drawn over, each in a section of its own after the one holding the pages. It holds no signature: the service does not sign. Signing is done later, by whoever holds the answer, in a section appended after these. -
A
signature_fieldbesideadd_tonames a single page inpages, unless the render creates one page. One that lands on more than one rendered page, or is named like another, is refused with a 400 that says so. -
Refused with a 400 beside
add_to: a request that also asks forbookmarks,metadata,archive,protection,structure, layers, links or form fields other than asignature_field; asignature_fieldnamed like a field the supplied PDF's form already holds, one thatlocksother fields, and one that acts on an event; a name no part was supplied for; a page to draw over past the supplied PDF's last; a supplied PDF that is protected or whose cross-reference table cannot be followed; and anovernaming more pages than the render created. Adding to a supplied PDF needs a licence key: an evaluation server answers 402.
Scope: every PDF the request supplies, whether it is stamped onto or placed. It settles nothing about the document being written, only about the files being read.
A Whole Request That Creates a PDF
{
"supplied_pdfs": { "expansion_limit": 33554432 },
"standard_fonts": [{ "name": "sans", "face": "helvetica" }],
"items": [
{
"type": "pdf_page",
"pdf": "letterhead",
"page": 1,
"rect": { "llx": 0, "lly": 0, "urx": 595.276, "ury": 841.89 }
},
{
"type": "text",
"rect": { "llx": 72, "lly": 700, "urx": 523, "ury": 740 },
"content": ["Written over the sheet that was supplied"],
"font": "sans",
"font_size": 12
}
]
}
The sheet, and what is laid under it
The Size of the Pages A Size of Its Own for Certain Pages The Unit a Page Is Measured In Where a Page's Sheet Sits in the Drawing The Areas a Page States The Shapes a Page Lays over What It Draws Which Way up a Page Is Shown How a Page Arrives, and How Long It Stands A PDF You Send, as the Pages Themselves The Template under the Pages A Watermark Laid across a Run of Pages Named Regions a Page Marks for Filling
Where to Go Next
Every JSON key of a request, in one page The other forty-one settings of a request