Error: addImage does not support files of type 'UNKNOWN', please ensure that a plugin for 'UNKNOWN' support is added.
Hello, First, thank you for the package!
I encountered this error : "Error: addImage does not support files of type 'UNKNOWN', please ensure that a plugin for 'UNKNOWN' support is added" while using the package today, It started before I made any changes to my code,( was working before ).
I'm using the generatePDF function like so
generatePDF(editorWrapperRef, { filename: "page.pdf", overrides: {}, });
Stack Trace
[Error] Unhandled Promise Rejection: Error: addImage does not support files of type 'UNKNOWN', please ensure that a plugin for 'UNKNOWN' support is added. P2 (react-to-pdf.js:3496:200) (anonymous function) (react-to-pdf.js:3486) convert (react-to-pdf.js:8660) (anonymous function) (react-to-pdf.js:8719)
can you provide the part of the code where you did the implementation of the PdfToReact hook
Having the same problem here
const contentRef = useRef<HTMLDivElement>(null); useImperativeHandle(ref, () => ({ print: () => {}, download: () => generatePDF(contentRef, { filename: "pdf.pdf", method: 'save' }), }));
I've received a Sentry event with this error but haven't been able to reproduce myself. The user who encountered it was on Safari 16.6.1. I've tried with Safari 18.2 and that worked fine.
Perhaps related to https://github.com/parallax/jsPDF/issues/3692
I also encountered the same problem
this worked for me -
const { toPDF, targetRef } = usePDF({ filename: "invoice.pdf", overrides: { canvas: { scale: 2, imageTimeout: 15000, }, }, });
This error occurs when you set the element's width to more than 793px.
I eventually did it from scratch by using jsPDF and dom-to-image. I am not having any errors now. Also now I have more control over styling and layout.