Skip to content

Commit

Permalink
Add a fallback for client width calc
Browse files Browse the repository at this point in the history
  • Loading branch information
batman-nair committed Jun 29, 2022
1 parent 578d52d commit 970e677
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class BetterPDFPlugin extends Plugin {
const context = canvas.getContext("2d");

const baseViewportWidth = page.getViewport({scale: 1.0}).width;
const baseScale = canvas.clientWidth / baseViewportWidth;
const baseScale = canvas.clientWidth ? canvas.clientWidth / baseViewportWidth : 1;

const viewport = page.getViewport({
scale: baseScale * parameters.scale,
Expand Down

0 comments on commit 970e677

Please sign in to comment.