pdf width and height scales differently as snapshot
See original GitHub issue- Puppeteer version: 1.10.0
- Platform / OS version: mac HighSierra 10.13.4
- URLs (if applicable):
- Node.js version: v7.6.0
What steps will reproduce the problem?
const puppeteer = require('puppeteer');
const args = process.argv;
var browser;
var page;
(async() => {
try{
pageWidth = 800;
pageHeight = 990;
browser = await puppeteer.launch({timeout:0,args: ['--no-sandbox', '--disable-setuid-sandbox','-disable-web-security']});
page = await browser.newPage();
await page.setViewport({width:pageWidth, height:pageHeight});
await page.goto("file:" + args[3], { timeout: 0, waitUntil: 'networkidle0' });
await page.screenshot({path: '_/test.png'});
await page.pdf({path: args[4], printBackground: true, width: pageWidth, height:pageHeight});
}catch(err){
console.log(err);
}finally{
process.exit();
}
})();`
What is the expected result? The pdf is having page break the same way as the snapshot did, meaning no cutting off of the chart
What happens instead? The width and height of the pdf’s included range seemed to be scaled differently as the snapshot. I was expecting 800 and 990 is about right for a chart to fit in a page, but turns out 800 and 990 means more in pdf than it does in snapshot. The parameter of width and height pass in page.pdf does make a difference, just that there seems to be a scale comparing to how snapshot reacts to viewport size. test.pdf
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
pdf width and height scales differently as snapshot · Issue #3600
The width and height of the pdf's included range seemed to be scaled differently as the snapshot. ... 800 and 990 means more...
Read more >Print portion of a PDF page using Acrobat or Reader
How to print a portion of a page of a PDF document using Acrobat or Reader. Use the Snapshot Tool to select just...
Read more >Is there anyway to scale an image based on basepoint on pdf ...
The short answer is I don't know of a way to scale a snapshot using points. It sounds like your drawing and the...
Read more >Scaling Page Content in Adobe Acrobat Pro DC
Before Adobe Acrobat Pro DC, it was not possible to scale pages from e.g. 5×7″ to Letter size, or form A4 to A5...
Read more >How to scale PDF pages using Acrobat? - Software RT
Printing a PDF to create a new PDF can make all PDF pages the same size. It however will remove interactive content on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like width and height were scaled to 3/2 times of its passed parameter. In my case In order to get 600 x 440, I have to actually put in width 400 (400 = 600 x 2/3) and height 294 (293.3333 = 440 x 2/3) to get it.
Hopefully, this helps
I got this issue too with diff scale. The output pdf size is 750 * 750 when i pass 1000 * 1000 to puppeteer
pdf
method.