Skip to content

Fonts and images

Keep the input and assets together. PressJet's HTML renderer reads resources supplied by the caller. It uses the exact name in an image's src to look up a request attachment.

Attach an image

For CLI use, put logo.png next to the HTML and reference it as src="logo.png". For HTTP, include the named file in a multipart request.

curl --fail-with-body http://127.0.0.1:8080/v1/html \
  -H "Authorization: Bearer $PRESSJET_API_KEY" \
  --form-string 'request={"version":1,"html":"<h1>Statement</h1><img src=\"logo.png\" alt=\"Company logo\">"}' \
  -F 'logo.png=@logo.png;type=image/png' -o statement.pdf

You can also inline a data URL or send named base64 values through images. See attachment naming and limits. For meaningful images, include alternative text and choose dimensions that fit the print column.

Choose a font and fallback

Use a built-in family such as Helvetica, Times-Roman, or Courier, or provide an embeddable font. A fallback list such as Brand, Helvetica, sans-serif lets the document render with a local alternative if the first family is unavailable. Use per-request fonts or startup configuration when the brand font is required.

In local HTML, reference a font beside the source file with @font-face. For HTTP, embed the font in your stylesheet as a data URL or configure it in the deployment. Check the document for font_substituted and missing_glyph. A font can be installed and still lack characters needed by a specific record.