5

I'm the maintainer of https://github.com/fraserxu/electron-pdf which leverages Electron to capture webpages in PDF form using webContents.printToPDF.

I'm running into a challenge printing pages that contain iFrames with third-party content. I have no control over the CSS that these third-party sites are using, and if they have CSS for print media types the printed output differs compared to it's (normal) screen view.

The print media type is undesirable in this case, as the requirement is that the generated PDF should look identical to what the user sees in the browser (inside the iFrame).

I've searched high and low for a way to effectively disable the print media type when printing to PDF. I'm hoping someone out there has a solution to this problem.

Nate Good
  • 439
  • 4
  • 11
  • I did fine one possible solution that would work for same origin pages only: https://stackoverflow.com/a/32719918/5656782. But since the document can't be accessed for other origins that won't work for my use case. – Nate Good Jan 23 '20 at 21:29
  • any luck? I am having the same issue with electron – danial dehvan Jun 21 '21 at 17:47

0 Answers0