Shumiland/_generateGuide.mjs
Vadym Samoilenko 3d994b1bf7
Some checks are pending
CI / Type Check (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Unit Tests (push) Waiting to run
Deploy / Build & Push Image (push) Waiting to run
Deploy / Deploy to VPS (push) Blocked by required conditions
fix(mobile): responsive CoverflowSlider, LocationsSlider overlay, DinoPageContent hero+wheel overflow, gallery lightbox
2026-06-02 21:12:50 +01:00

23 lines
799 B
JavaScript

import { chromium } from './node_modules/.pnpm/playwright-core@1.60.0/node_modules/playwright-core/index.js'
import { readFileSync, writeFileSync, mkdirSync } from 'fs'
const guideHtml = readFileSync('/tmp/shumiland_guide.html', 'utf8')
mkdirSync('docs', { recursive: true })
let browser
try {
browser = await chromium.launch({
executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH,
})
const page = await browser.newPage()
await page.setContent(guideHtml, { waitUntil: 'networkidle' })
await page.pdf({
path: 'docs/shumiland-admin-guide.pdf',
format: 'A4',
margin: { top: '20mm', right: '15mm', bottom: '20mm', left: '15mm' },
printBackground: true,
})
console.log('PDF generated: docs/shumiland-admin-guide.pdf')
} finally {
await browser?.close()
}