Comments (14)
I think I have an easier way to solve this problem. In the latest version I added onload/onerror callbacks on copied stylesheets so once they're triggered we will know that they are loaded in the print window and only then do we trigger print.
If that doesn't solve the issue I'll reopen this
from react-to-print.
Mike, your English is fine. I understand. It's weird that not all the styles are coming over considering that it's copying style sheets from a parent window that should have already downloaded them and been cached in the browser. Do you maybe have caching disabled?
Could you walk me though the steps you take to trigger the bug? Is it consistent?
from react-to-print.
Sure. I'll do it a little bit later.
from react-to-print.
Sorry for the delay, a lot of work :) Yes, I have caching enabled and I do everything like in the documentation. On my localhost it works fine. But when I'm trying to print on server, I get this issue. I know, it's a little bit weird :) It could be fixed by increasing timeout. But I think it's better to wait all styles loading.
from react-to-print.
Yeah it's still an odd issue I haven't had time myself to test this out more. I'll try to get around to it. It can't hurt to see an implementation with it being promisfied if you still want to complete that
from react-to-print.
Sure!
from react-to-print.
Hi, I have been using the library to try to generate some pdf. It's a great and easy way to use the library by only using html and css to style the invoice, and it works great on localhost. However, when i use it on production, the style always fails to load on the first attempt to print the file. The print window still pops up before the style loads, or rather the style does not load at all. If i close the window and try a second time the style will load properly after waiting for a while. (sometimes the print window does not even pops up after the style is loaded).
from react-to-print.
@thamjieying could you share your environment details with us? OS, node version, etc
from react-to-print.
I am using this library on the client side using react, and nodejs v8.7.0 as the server. I am developing using macOS. Does these affect the performance?
from react-to-print.
No, just trying to understand what your environment is. Which browser are you using? If you try different browsers do you still have issues?
from react-to-print.
I have tried on mac with chrome, firefox, Opera and safari,
and windows on chrome firefox, Opera and edge.
the browser on mac always fails on the first attempt to download, as i have described,
on pc, chrome has the same problem, firefox rendered correctly on screen but style is never transferred to the downloaded pdf. Only opera and edge works fine on windows.
from react-to-print.
I'm not seeing an issue @thamjieying look at this example here where I pull in a completely foreign CSS file from w3c schools: https://3vqww5xo0m.codesandbox.io/#
Do you see the styling come over?
from react-to-print.
@gregnb I tried yours and it worked fine. I don't know what's wrong with mine. maybe the style fine is too big? Thanks for the prompt reply. I might try another library if the problem still persist.
from react-to-print.
@thamjieying Hey. Were you able to solve the issue. I am also facing the same issue. The styles are not loaded the first time print window opens. On subsequent opens, the styles get loaded.
from react-to-print.
Related Issues (20)
- Superscripts <sup/> and subscripts <sub/> HOT 1
- react-to-print custom print html content dev vs prod discrepancy HOT 4
- [BUG] [TEMPORARY FIX] - Print container on Chrome + MUI is hiding `Header and Footers` option as default behavior HOT 5
- The FOOTER to only display at the LAST PAGE HOT 3
- codesandbox examples are not loading HOT 2
- onAfterPrint is called before print iframe appears HOT 1
- On mobile devices are not truncated accordingly ref HOT 1
- Add Border to every Page HOT 4
- Add dynamic colors to print function HOT 1
- How to check that the user click on Save in `onAfterPrint`? HOT 2
- getting Supplied Data is not a valid base64-String jsPDF.convertStringToImageData erorr while directly downloading image HOT 1
- Border top and bottom HOT 1
- Save as PDF hangs in print view HOT 1
- Blank PDF when trying to generate in production. HOT 2
- How should i handle large data to print? HOT 8
- Why does it render different content when in im browsing in mobile HOT 3
- Blank Page while printing after a certain period of time HOT 9
- How to add style using PageStyle prop, without it overriding component’s style HOT 5
- Warning: findDOMNode is deprecated outside StrictMode. HOT 10
- Unhandled error when trying to print not fully loaded canvas elements HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-to-print.