react-pdf-html icon indicating copy to clipboard operation
react-pdf-html copied to clipboard

TypeError: Failed to set an indexed property [0] on 'CSSStyleDeclaration

Open wogno opened this issue 1 year ago • 5 comments

Hi guys, I faced with this error

TypeError: Failed to set an indexed property [0] on 'CSSStyleDeclaration': Indexed property setter is not supported. at setValueForStyle (http://localhost:5173/node_modules/.vite/deps/react-dom_client.js?v=5deb1073:2145:452) at setValueForStyles (http://localhost:5173/node_modules/.vite/deps/react-dom_client.js?v=5deb1073:2192:55

My code
<Document > 
            <Page>
                <Html>{html}</Html>
            </Page>
        </Document>
        
  My HTML
   const html = `<html>

Heading 1

Heading 2

Heading 3

Heading 4

Paragraph with bold, italic, underline, strikethrough, and all of the above

link


  • Unordered item
  • Unordered item
  1. Ordered item
  2. Ordered item





Text outside of any tags
Column 1 Column 2 Column 3
Foo Bar Foobar
Foo Bar
Some longer thing Even more content than before! Even more content than before!

`;

wogno avatar Jan 15 '25 15:01 wogno

Same. I usually get this error when passing an array in styles, instead of an object.

Abdul-Asa avatar Jan 28 '25 18:01 Abdul-Asa

Same issue here

Julio-de-Leon avatar Feb 10 '25 00:02 Julio-de-Leon

If you're using the first code in the README i kept deleting the elements one by one and i discovered the problem is from the <img> tag and the <a> tag when i deleted them the error disappeared but the styles are not working i get style="0:[object Object];1:[object Object]" in my inspect element in the browser

Wissaladd avatar Feb 11 '25 20:02 Wissaladd

Try rendering the document inside a <PDFViewer />

Allan0x0 avatar Apr 04 '25 15:04 Allan0x0

I am facing Error try to resolve

omerpropqwiz avatar Jun 20 '25 11:06 omerpropqwiz