我正在致力于渲染网站的 PDF。我希望第一页有不同的页眉和页脚,其余页面也有不同的页眉和页脚。有什么办法可以做到这一点吗?
const puppeteer = require('puppeteer');
(async() => {
var t = Date.now();
console.log('Current time ' + t + ' msec');
const browser = await puppeteer.launch({executablePath: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', ignoreHTTPSErrors:true, headless:true, devtools:false});
const page = await browser.newPage();
await page.setViewport({width: 1920, height: 1080});
await page.setExtraHTTPHeaders({'Report-Print-Preview-Mode':'true'});
await page.goto('https://localhost', {waitUntil: 'networkidle2'});
await page.type('#username', 'scott');
await page.type('#password', 'tiger');
await page.click('[id="login_button"]');
await page.waitForSelector('[id="new_page_table_id"]');
await page.on('console', msg => console.log('PAGE LOG:', msg.text()));
// page.pdf() is currently supported only in headless mode.
// @see https://bugs.chromium.org/p/chromium/issues/detail?id=753118
await page.pdf({
path: …Run Code Online (Sandbox Code Playgroud) 我正在努力在应用程序中添加实时通知
我已经用-Spring Boot-Spring WebSocket-SockJS-RabbitMQ STOMP插件完成了POC
我阅读了有关RabbitMQ Web STOMP的文章,并希望对此进行POC。但它说,自3.7版以来,已删除了对SockJS websocket仿真的支持。
是否有带有或不带有SockJS的Spring WebSocket + RabbitMQ Web STOMP的示例。
请帮忙。
参考链接:
http://www.rabbitmq.com/stomp.html
我正在通过网页创建PDF。
我正在处理的应用程序是单页应用程序。
我在https://github.com/GoogleChrome/puppeteer/issues/1412上尝试了许多选项和建议
但这不起作用
const browser = await puppeteer.launch({
executablePath: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
ignoreHTTPSErrors: true,
headless: true,
devtools: false,
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
const page = await browser.newPage();
await page.goto(fullUrl, {
waitUntil: 'networkidle2'
});
await page.type('#username', 'scott');
await page.type('#password', 'tiger');
await page.click('#Login_Button');
await page.waitFor(2000);
await page.pdf({
path: outputFileName,
displayHeaderFooter: true,
headerTemplate: '',
footerTemplate: '',
printBackground: true,
format: 'A4'
});
Run Code Online (Sandbox Code Playgroud)
我要的是在页面完全加载后立即生成PDF报告。
我不想写任何类型的延迟,即await page.waitFor(2000);
我无法使用waitForSelector,因为该页面具有在计算后呈现的图表。
帮助将不胜感激。