Skip to content

Commit

Permalink
Ensure the print iframe doesn't overlap the page
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Herbst committed Nov 17, 2022
1 parent 1ed74f8 commit 0b49c6c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ export default class ReactToPrint extends React.Component<IReactToPrintProps> {

const printWindow = document.createElement("iframe");
printWindow.width = `${document.documentElement.clientWidth}px`;
printWindow.height = `${document.documentElement.clientHeight}px`;
printWindow.height = `${document.documentElement.clientWidth}px`;
printWindow.style.position = "absolute";
printWindow.style.top = "-1000px";
printWindow.style.left = "-1000px";
printWindow.style.top = `-${document.documentElement.clientWidth + 100}px`;
printWindow.style.left = `-${document.documentElement.clientWidth + 100}px`;
printWindow.id = "printWindow";
// Ensure we set a DOCTYPE on the iframe's document
// https://github.com/gregnb/react-to-print/issues/459
Expand Down

0 comments on commit 0b49c6c

Please sign in to comment.