Skip to content

Commit

Permalink
Removed print resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Jul 19, 2023
1 parent 1e29c19 commit e6f4ad7
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions src/commands/GeneratePDF.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,9 @@
import { IEvent } from "../IEvent";
import Command from "./Command";

let document: any;

function getMaxPageSize() {
return Array.from<any>(document.all).reduce((a, c) => Math.max(c.scrollHeight , a) , 0);
}

export default class GeneratePDF extends Command {
async render({ outputFile: path, page, output, pdf }: IEvent) {

const height = await page.evaluate(getMaxPageSize);

const {
width,
isMobile,
deviceScaleFactor,
hasTouch,
isLandscape
} = page.viewport();

await page.setViewport({
width,
height,
isMobile,
deviceScaleFactor,
hasTouch,
isLandscape
});

await page.emulateMediaType("screen");

const pf = typeof pdf === "object"
? { ... pdf, path}
: { path };
Expand Down

0 comments on commit e6f4ad7

Please sign in to comment.