printpdf icon indicating copy to clipboard operation
printpdf copied to clipboard

Some HTML tags cannot be parsed correctly

Open 54Joshua opened this issue 9 months ago • 1 comments

hello, I have some problem when use printpdf-0.8.2 。 html=r#"

test html test
this is printpdf "#

but I get : Result::unwrap() on an Err value: "Error constructing DOM: Error rendering DOM: Unknown component: "br""

54Joshua avatar Mar 24 '25 08:03 54Joshua

Yeah, the HTML parser is not really for production.

It doesn't know what the "br" tag corresponds to, i.e. internally it has "components" that take the node and generate a simplified layout for it, for example to transform

<ol>
    <li>
        <p></p>
    </li>
</ol>

into

<div class='__internal__ol'>
    <div class='__internal_li'>
        <p></p>
    </div>
</div>

fschutt avatar Mar 24 '25 08:03 fschutt