Closed PandukaNandara closed 1 year ago
Yes, you can add the lib to a react project, but it will not generate a PDF file, clinets depend on the browser's capability to generate the output. so the user needs to choose save it as PDF in the browser
I am trying to use useReactToPrint
to print the ReportView
, it will trigger browser's print dialog. And the styles between them are different. I want to know is there a function I could make them are the same.
You don't need the useReactToPrint
, just call window.print()
after the page load is completed.
unfortunately, I don't think the library has any mechanism to notify you when the page load is completed. I'll work on it for the next version but for now, you can use polling:
function isReady() {
const poll = resolve => {
if(window.__jikji_isReady === true) resolve();
else setTimeout(_ => poll(resolve), 200);
}
return new Promise(poll);
}
and
isReady().then(x=> window.print())
I'll close the issue. please feel free to reopen if you still have a problem with it
I want to generate PDF using this library. Is it possible to generate without server?