Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styles missing in print dialog #382

Closed
lohiaumang opened this issue Jun 5, 2021 · 5 comments
Closed

Styles missing in print dialog #382

lohiaumang opened this issue Jun 5, 2021 · 5 comments

Comments

@lohiaumang
Copy link

lohiaumang commented Jun 5, 2021

Hi,

I have a component that looks like this -

Screenshot 2021-06-05 at 7 50 49 PM

But when I print this, I get this in the print dialog -

Screenshot 2021-06-05 at 7 51 30 PM

I am using bootstrap grid with react (which uses flexbox). I am using the library like this -

const deliveryOrderTableRef =
    useRef() as React.MutableRefObject<HTMLDivElement>;
const printPage = useReactToPrint({
    content: () => deliveryOrderTableRef.current,
    copyStyles: true,
});

<div className="delivery-order-table" ref={ref}>

@lohiaumang lohiaumang changed the title My component styles are missing in the print dialog Styles missing in print dialog Jun 5, 2021
@MatthewHerbst
Copy link
Owner

Hello. Could you please make a working codesandbox or similar so I can see the issue and try to debug? I've seen similar issues before and normally what's happening is that bootstrap is thinking the printer is a small viewport and so sizes everything down to sm which often throws off styles from what people expect

@lohiaumang
Copy link
Author

lohiaumang commented Jun 7, 2021

Hi Matthew, I created a project that shows my problem here - https://stackblitz.com/edit/react-f7gtpf?file=src/App.js. Press the Open in New Window button to see it on a full browser screen. Let me know if you have any problems viewing it. Thanks for the prompt reply.

@lohiaumang
Copy link
Author

Hi @MatthewHerbst, any insights into how I can solve this problem will be very helpful. Thank you

@MatthewHerbst
Copy link
Owner

@lohiaumang apologies for not getting back to you. Were you able to solve this?

@lohiaumang
Copy link
Author

Hi @MatthewHerbst, figured I should make sure that the right styles are being applied at the xs screen size. I had the layout designed for the sm screen size and above. Just changing sm to xs solved the issue. Your reply from earlier was quite helpful, thanks 😄

Hello. Could you please make a working codesandbox or similar so I can see the issue and try to debug? I've seen similar issues before and normally what's happening is that bootstrap is thinking the printer is a small viewport and so sizes everything down to sm which often throws off styles from what people expect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants