elimde html ile olusturdugum bir sayfa var bunu pdf e bastiriyorum ama icerigin boyutu kücük bunu A4 boyutunda PDF e nodejs ile bastirmak istiyorum
hizlica yapabilecekler yazsin lütfen
Html icerigi nodejs ile A4 boyutunda pdf e basma ücretli
4
●156
- 27-10-2024, 04:11:08Üyeliği durduruldu
const puppeteer = require('puppeteer'); (async () => { // Tarayıcıyı başlat const browser = await puppeteer.launch(); const page = await browser.newPage(); // HTML içeriğini sayfaya yükleyin const htmlContent = ` <html> <head> <style> body { font-size: 12pt; /* Yazı boyutunu ayarlayın */ } </style> </head> <body> <h1>PDF Oluşturma</h1> <p>Bu bir örnek metin.</p> </body> </html> `; await page.setContent(htmlContent, { waitUntil: 'domcontentloaded' }); // PDF oluştur await page.pdf({ path: 'output.pdf', // Çıktı dosyasının yolu format: 'A4', // A4 boyutu printBackground: true // Arka planı yazdır }); // Tarayıcıyı kapat await browser.close(); })();
