Uploading document assets
Usually, images, stylesheets, and fonts referenced from your HTML are fetched over the network while the PDF is generated — which means they have to be publicly reachable. Alternatively, you can upload a ZIP archive containing those files alongside your document, and reference them by relative URL.
This is useful when your assets are not publicly available (for example, behind a login), when you want to avoid the latency of fetching them, or when you simply want a document and everything it needs to be one self-contained request.
Requirements
To upload document assets, an API call must look like this:
- The request must be sent as
multipart/form-data(JSON requests cannot carry file uploads). - Every parameter must be namespaced under
doc[…]— for exampledoc[document_content]ordoc[prince_options][media]. - The ZIP archive goes into the
doc[document_assets]field. - The
Prince16.2pipeline must be used (see Prince versions).
Example request
Assuming a ZIP archive assets.zip and a document invoice.html:
curl "https://api.europdf.eu/v1/docs?api_key=YOUR_API_KEY" \
-F "doc[pipeline]=Prince16.2" \
-F "doc[document_content]=<invoice.html" \
-F "doc[document_assets]=@assets.zip" \
-o invoice.pdf
See the API reference for /docs (multipart) for the full list of parameters.
Referencing assets from your HTML
Relative URLs in your document are resolved against the root of the ZIP archive, so the paths in your HTML mirror the structure of the archive.
Given an archive like this:
assets.zip
├── invoice.css
└── images/
├── logo.svg
└── signature.png
your document references those files exactly as it would in a normal web project:
<link rel="stylesheet" href="invoice.css">
<img src="images/logo.svg" alt="Acme Corporation">
Assets are served over HTTP from inside the rendering container, so relative URLs behave just like they would on a web server. Absolute URLs still work as usual — a document can mix uploaded assets and resources fetched from the network.
JavaScript preprocessing
Document assets work together with JavaScript preprocessing (javascript=true). The assets are served under the same relative URLs during preprocessing, so scripts that load images or other resources relatively behave the same as they would in a browser.
Limits
The total size of all assets (after extracting the archive) may not exceed 64 MB.
Options that cannot be combined with assets
Some API options conflict with uploaded assets – requests containing these options will be rejected:
document_url— when uploading document assets, the HTML must be provided inline (usingdocument_content). Referencing an external URL would result in conflicting base URLs.prince_options[baseurl]— relative URLs are already resolved against the uploaded assets, so a second base URL would be contradictory.prince_options[no_network]— the assets are served over HTTP, so disabling network access would make them unreachable.
What we store
Uploaded assets are stored while the PDF is generated and deleted immediately afterwards — regardless of the retention period configured for your API key.
What we do keep is a manifest: a listing of the files (path, type, size) that were extracted from your archive. It is shown alongside the document request in the EuroPDF backend to help debugging problems (like a missing asset or a path mismatch).
The manifest is subject to the retention period of your API key: it is deleted together with the document content, the PDF, and the process log when the document is incinerated.