• 26-10-2024, 17:11:42
    #1
    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
  • 26-10-2024, 18:19:44
    #2
    Profilimde whatsapp mevcut
  • 27-10-2024, 04:02:15
    #3
    Merhaba yardımcı olabilirim
  • 27-10-2024, 04:11:08
    #4
    Ü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();
    })();
  • 27-10-2024, 05:24:08
    #5
    Üyeliği durduruldu