Skip to main content

Integration

PDFSamurai provides two ways to generate PDFs programmatically from your templates: a JavaScript library and a Docker server. Both process data locally — dynamic data never leaves your infrastructure.

Choose your integration

JavaScript Library

Install @pdfsamurai/pdfsamurai-js and generate PDFs directly in your application. Works in the browser and in Node.js.

Best for:

  • Browser-based PDF generation (e.g., client-side downloads)
  • Node.js applications where you want direct control over PDF generation

Get started with the JavaScript library →

Docker Server

Run pdfsamurai/server as a container and generate PDFs via HTTP requests. Uses the JavaScript library internally, with built-in worker threads and request queuing.

Best for:

  • Backends not written in JavaScript (Python, Go, Java, PHP, Ruby, etc.)
  • Node.js applications that need concurrent PDF generation out of the box
  • Microservice architectures where PDF generation runs as a separate service

Get started with the Docker server →

Prerequisites

Before integrating, make sure you have:

  • A PDFSamurai account
  • At least one template created in the Editor
  • An API key from your Dashboard
  • A developer key from your Dashboard (requires Developer Mode enabled)

Developer keys

Developer keys identify your app or integration. They are required alongside an API key when using the JavaScript library or Docker server.

To create a developer key:

  1. Go to Account Settings in the Dashboard and enable Developer Mode.
  2. Navigate to the Developer Keys page in the sidebar.
  3. Click New developer key to generate a key.

Store your developer key securely — you can view it once and copy it, but it will be masked afterward.

How it works

  1. Design a template in the PDFSamurai Editor with dynamic data placeholders.
  2. Get your API key and developer key from the Dashboard.
  3. Call the library or server with your template ID, API key, developer key, and data.
  4. Receive the PDF as a binary file, buffer, blob, or base64 string.

The library fetches your template definition, fonts, images and svgs from the PDFSamurai API, then generates the PDF entirely on your side. Only the template definition and needed assets are fetched remotely — your dynamic data stays local.