Skip to content

Commit 643919d

Browse files
Ensure the print iframe doesn't overlap the page (MatthewHerbst#556)
1 parent 1ed74f8 commit 643919d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ export default class ReactToPrint extends React.Component<IReactToPrintProps> {
218218
printWindow.width = `${document.documentElement.clientWidth}px`;
219219
printWindow.height = `${document.documentElement.clientHeight}px`;
220220
printWindow.style.position = "absolute";
221-
printWindow.style.top = "-1000px";
222-
printWindow.style.left = "-1000px";
221+
printWindow.style.top = `-${document.documentElement.clientHeight + 100}px`;
222+
printWindow.style.left = `-${document.documentElement.clientWidth + 100}px`;
223223
printWindow.id = "printWindow";
224224
// Ensure we set a DOCTYPE on the iframe's document
225225
// https://github.com/gregnb/react-to-print/issues/459

0 commit comments

Comments
 (0)