Node.js Examples

Complete Node.js integration examples for Speed stein PDF API

Installation

npm install node-fetch

Basic Usage

const fetch = require('node-fetch');

async function generatePDF() {
  const response = await fetch('https://api.speedstein.com/v1/pdf/generate', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.SPEEDSTEIN_API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      html: '<html><body><h1>Hello PDF!</h1></body></html>',
      options: {
        format: 'A4',
        orientation: 'portrait'
      }
    })
  });

  const data = await response.json();
  console.log('PDF generated:', data.download_url);
}

generatePDF();