import React from 'react';
import { renderToFile } from '@react-pdf/renderer';
import { PDFPage } from './lib/pdf-page';
import fs from 'fs';

const pageData = JSON.parse(fs.readFileSync('./lexical_avb.json', 'utf8'));
const page = { title: "Test AVB", content: pageData };

async function run() {
  try {
    await renderToFile(<PDFPage page={page} locale="de" />, 'test-render.pdf');
    console.log('PDF rendered successfully offline!');
  } catch(e) {
    console.error('PDF Generation failed:');
    console.error(e);
  }
}

run();
