typst / svg2pdf

Converts SVG files to PDF.
Apache License 2.0
273 stars 32 forks source link

`convert_tree_into` doesn't work #53

Closed J-Kappes closed 6 months ago

J-Kappes commented 7 months ago

Following the example I get the error message

243  | svg2pdf::convert_tree_into(&tree, svg2pdf::Options::default(), &mut pdf, svg_id);
     | -------------------------- ^^^^^ expected `usvg_tree::Tree`, found `Tree`
     | |
     | arguments to this function are incorrect

If I replace &tree with usvg_tree::Tree::from(tree) I get

242 | svg2pdf::convert_tree_into(usvg_tree::Tree::from(tree), svg2pdf::Options::default(), &mut pdf, svg_id);
    | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&Tree`, found `Tree`
    | |
    | arguments to this function are incorrect

If I add a & I get

242  | svg2pdf::convert_tree_into(&usvg_tree::Tree::from(tree), svg2pdf::Options::default(), &mut pdf, svg_id);
     | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usvg_tree::Tree`, found `Tree`
     | |
     | arguments to this function are incorrect
LaurenzV commented 7 months ago

You are probably using the wrong version of usvg in your project. For the current release, you need to use version 0.36. It should work if you specify that specific version.

We should probably just re-export usvg_tree in svg2pdf to prevent those kinds of errors.

LaurenzV commented 6 months ago

usvg is now reexported.