Browse Source

Changed the media query to "print" instead of "screen", for obvious pdf render reasons

Florian 6 months ago
parent
commit
d4f71fa4db
1 changed files with 3 additions and 3 deletions
  1. 3 3
      main.js

+ 3 - 3
main.js

@@ -33,9 +33,9 @@ const fs = require('fs');
         
         const browser = await puppeteer.launch();
         const page = await browser.newPage();
-        console.log("Rendering data...")
+        console.log("Rendering data...");
         await page.goto(url, {waitUntil: 'networkidle0'});
-        await page.emulateMediaType('screen'); // To use normal CSS instead of only print styles
+        await page.emulateMediaType('print');
         
         
         console.log("Creating the PDF document...");
@@ -53,7 +53,7 @@ const fs = require('fs');
                 right: "1.27cm",
                 top: "1.27cm",
                 bottom: "1.27cm",
-            },
+            }
         });
 
         console.log('Conversion complete. PDF file generated successfully.');