Skip to main content

Pogodoc Quickstart

Generate documents in seconds using Pogodoc with TypeScript.

Prerequisites

Before getting started with Pogodoc, make sure you have:

  • Node.js (version 18 or higher)
  • A Pogodoc account - Sign up here if you don't have one
  • A Pogodoc API token - Generate one from your API tokens page

1. Installing the package

Before using the Pogodoc SDK, you can install the required package:

npm install @pogodoc/sdk 

2. Create a client

Before creating a pogodoc client you need to generate POGODOC API token

import { PogodocClient } from "pogodoc";

const pogodoc = new PogodocClient({
token: process.env.POGODOC_API_TOKEN!,
});

⚠️ Don’t forget to set your POGODOC_API_TOKEN in your .env file.

3. Generate a document

const template = `<h1>Hello <%= name %></h1>`;

const data = {
name: "John Doe",
};

const response = await pogodoc.generateDocument({
template,
data,
renderConfig: {
type: "ejs",
target: "pdf"
},
});

console.log(response.output?.data.url);

Learn more