Files
web_marszalekarchitekten/generate-pdf.js
cgasser af02d4bd66 Initial commit: static site + Docker setup for Marszalek Architekten
- Single-page HTML website (no CMS) with portfolio grid, services,
  team and contact sections; content extracted from marszalekarchitekten.at
- 2-page PDF info sheet generated via Puppeteer from HTML template
- nginx:alpine Docker image with custom nginx.conf (caching, gzip, headers)
- docker-compose.yml for Portainer deployment on port 3080

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 11:37:52 +02:00

31 lines
907 B
JavaScript

const puppeteer = require('puppeteer-core');
const path = require('path');
(async () => {
const browser = await puppeteer.launch({
executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
headless: 'new',
args: ['--no-sandbox', '--disable-setuid-sandbox'],
});
const page = await browser.newPage();
const templatePath = 'file:///' + path.join(__dirname, 'infosheet-template.html').replace(/\\/g, '/');
await page.goto(templatePath, { waitUntil: 'networkidle0', timeout: 15000 });
// Wait for Google Fonts to load
await new Promise(r => setTimeout(r, 1500));
const outPath = path.join(__dirname, 'marszalek-architekten-infosheet.pdf');
await page.pdf({
path: outPath,
format: 'A4',
printBackground: true,
margin: { top: 0, right: 0, bottom: 0, left: 0 },
});
await browser.close();
console.log('PDF written to', outPath);
})();