react-easy-print icon indicating copy to clipboard operation
react-easy-print copied to clipboard

Get different results from window.print() and ctrl+p

Open bofa opened this issue 7 years ago • 10 comments

I am getting different results from ctrl + p and window.print() in chrome 59

bofa avatar Jul 21 '17 11:07 bofa

Hey, @bofa

Show me more info please (a screenshot and code sample will be cool)

a-x- avatar Jul 21 '17 11:07 a-x-

@bofa I had the same problem, you just have to wrap the things you're not printing with <NoPrint> </NoPrint>

Bamii avatar Sep 26 '17 08:09 Bamii

Yep, it was designed as so to cover multiple use-cases

a-x- avatar Sep 26 '17 13:09 a-x-

I'll add example with <NoPring> in top level

a-x- avatar Sep 26 '17 13:09 a-x-

https://github.com/a-x-/react-easy-print/commit/019c54347063ddb0ba2cd5b67939706ff85b6612

a-x- avatar Sep 26 '17 13:09 a-x-

@bofa Has this solved your problem?

Bamii avatar Sep 28 '17 07:09 Bamii

I could confirm the issue (tested on Chrome), and that the workaround works.

When using Ctrl + P, with <Print exclusive>, it works like a charm, but it doesn't work with window.print().

Refactoring the code to use Print and NoPrint as @Bamii commented, instead of the exclusive usage, it works fine both ways.

adrifmonte avatar Oct 27 '17 20:10 adrifmonte

I've added <NoPrint> on top level still Ctrl+p and window.print have different view

BTARPAR avatar Apr 16 '19 19:04 BTARPAR

Work around : add @media print and give styling to you app using position:relative and bottom property not a good solution but it serving its purpose for now

BTARPAR avatar Apr 16 '19 21:04 BTARPAR

this still bug anyway <PrintProvider> <NoPrint> ...code </NoPrint> <Print> ..code </Print> </PrintProvider>

reyapr avatar Aug 17 '19 08:08 reyapr