Idea is to print pdf documents that I am dislaying in pdfviewer component that I have created. I am getting Uint8Array from the server and that is rendered inside component. All works, so good so far.
Problem starts with implementing printing functionality inside my pdf viewer. I am rendering pdf with react-pdf library as SVG.
const PdfViewer = (props) => {
// removed code that is not important for this issue
const elmRef= useRef()
// removed code that is not important for this issue
const handlePrint = useReactToPrint({
content: () => elmRef.current
});
//const handlePrint = useReactToPrint({
return (
<Dialog className="dialogBox" title={props.dataItem[props.field]} onClose={props.modalAction} height={'95vh'} width={'90vw'} onClose={props.onClose}>
<PdfDocumentControls
handlePrint={handlePrint}
/>
<BasePdfViewer className='pdfViewer' pageNumber={pageNumber} file={file} onDocumentLoadSuccess={onDocumentLoadSuccess} zoom={zoom} refElm={elmRef} />
{props.children}
</Dialog>
);
};
When "handlePrint" triggers I am getting dialog box, but it seems not to be able to render svg.
Question: Is there a way to render this SVG properly, as text inside print box?