Skip to content

Commit

Permalink
fix: Default viewport for images
Browse files Browse the repository at this point in the history
  • Loading branch information
tabiodun committed Jun 22, 2024
1 parent 5865fb4 commit 1b97bf9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/construct/awscdk/pdf-renderer/src/handler.lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ const doRender = async (
})
} else {
if (width || height) {
const defaultViewport = { width: 1280, height: 720 }
await page.setViewport({
width: width ? parseInt(width, 10) : page.viewport().width,
height: height ? parseInt(height, 10) : page.viewport().height,
width: width ? parseInt(width, 10) : defaultViewport.width,
height: height ? parseInt(height, 10) : defaultViewport.height,
})
}
const screenshot = await page.screenshot({
Expand Down

0 comments on commit 1b97bf9

Please sign in to comment.