You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to pre-render a PDF by creating a react component and then passing that serialized copy to the pdf renderer?
I am trying to generate large PDF's and using a web worker but the issue is that the PDFs are generated using DOM elements and other properties not available in web workers (like css variables)
My ideal scenario will be to render the component in the main thread then pass the serialized component to the web-worker.
Something like
constcomponent=<Document><Page>{...logic}</Page></Document>;constserialised=component.toStream();// this is where it would be great to serialise into a string, binary etcconstblob=awaitwebWorker.renderPdfBlob(serialised);
The webworker can deserialise and pass that into pdf(deserialised).toBlob();
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is it possible to pre-render a PDF by creating a react component and then passing that serialized copy to the pdf renderer?
I am trying to generate large PDF's and using a web worker but the issue is that the PDFs are generated using DOM elements and other properties not available in web workers (like css variables)
My ideal scenario will be to render the component in the main thread then pass the serialized component to the web-worker.
Something like
The webworker can deserialise and pass that into
pdf(deserialised).toBlob();
Beta Was this translation helpful? Give feedback.
All reactions