Skip to main content
Chromium converters and LibreOffice accept an embeds array to attach files to the generated PDF. Each item can be a file path string, a Buffer, or a ReadStream.
import { HtmlConverter } from "chromiumly";

const htmlConverter = new HtmlConverter();
const buffer = await htmlConverter.convert({
  html: "path/to/index.html",
  embeds: [
    "path/to/invoice.xml",
    "path/to/logo.png",
    Buffer.from("additional data"),
  ],
});
Embedded files are attached to the PDF and can be extracted in readers that support attachments. This is used for ZUGFeRD / Factur-X and similar standards that require embedding XML or other files inside the PDF.