-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
How to printout hidden content #747
Comments
Yes! Very much so. Is your content rendered but not visible (e.g. |
I have content that is currently set to 'display: none' and is therefore not visible. I need to print this hidden content without changing its display status |
for your case, you'll need to modify the print before printing, such as setting 'display: block' to make the hidden content visible.
|
For that first example, you'll want to see the section in the README about changing state within |
@MFaad1 If you want something to be visible when printed, you should set it to 'display: block or any other than none' via 'onBeforePrint' or '@media print'. Or can you make a Codesandbox or similar showing the problem? |
@siaikin I need to print confidential documents/files without displaying them on screen, ensuring their contents remain hidden from view. |
There is no problem with your needs, which can be achieved by setting up css. Can you provide an online example with codesandbox or something else?
|
@siaikin I want to exclude the previously highlighted area (in red) from the print preview (in the browser) but still print the underlying content. |
@MFaad1 what @siaikin is suggesting is to use @media print {
.hiddenContent {
display: block;
}
.normalContent {
display: none;
}
} |
I'm using @media print to customize my print output, but when I hide the unwanted content using display: none or visibility: hidden, it also excludes that content from the physical print. How can I hide it from the print preview while still printing the content? |
If I understand it correctly, you want to hide the content from the browser's print preview dialog? That's not possible. If a user is able to print the physical document why is it a problem if they can see what they are printing? If users just need to download the document rather than physically printing it, you could create a PDF or something with the content and download it directly onto their machine rather than using the printing workflow. You would need to use the custom |
I'm just now understanding your need 😂, "You want to not show something in the print preview in your browser, but you want to print it on paper," right? If so, instead of react-to-print, you can hand over the print task to a printing software instead of using the browser's print function (which will prevent the print preview window from being displayed). |
@siaikin how I can handover print task to printing software instead of using the browser's print function ? @MatthewHerbst Do we have any option fo this? |
Yes, kind of. As mentioned above, you'll need to use the |
@MFaad1 did you end up finding a solution that works for you? |
@MatthewHerbst No, Didn't find any solution |
@MFaad1 happy to try and keep helping you if you are able to share more code. Going to close this issue for now, but feel free to keep commenting |
I have hidden content that is not visible in the browser. Now, I want to print this content without displaying it in the UI. Is it possible?
The text was updated successfully, but these errors were encountered: