Onedoc is currently in private beta only mode. Contact us to get access and try our solution.


To get the most out of this guide, you’ll need to:

1. Installation

If you did not have set up a NodeJS project, you can use the following command to do so:

npm init -y

Get the Onedoc Node.js SDK

npm install -s @onedoc/client

2. Generate your PDF

Creat a new file generate.js, import the React document template and generate a PDF using your ONEDOC_API_KEY.

import { Onedoc } from "@onedoc/client";
import { readFileSync, writeFileSync } from "fs";

(async () => {
  const onedoc = new Onedoc(ONEDOC_API_KEY);

  let doc = {
    html: "<h1>Hello World</h1>",
    title: "Hello world",
    test: true,
    save: true,
    expiresIn: 30,
    assets: [],

  const { file, link, error, info } = await onedoc.render(doc);

  if (error) {
    throw error;


You are almost done ! Run the script using the following command :

node ./generate.js

4. Congratulations !

You just created your first PDF using Onedoc Node.js. You can now access your private dashboard to preview and download your PDF.

Ready to learn more ? Take a look at our SDK Reference or the different templates we offer to kickstart your next PDF generation.

5. Try it yourself !

Clone our local Dev environment !

Get started developing PDFs locally in just two command lines !