typst / svg2pdf

Converts SVG files to PDF.
Apache License 2.0
292 stars 38 forks source link

`convert_tree_into` doesn't work #53

Closed J-Kappes closed 9 months ago

J-Kappes commented 10 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 10 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 9 months ago

usvg is now reexported.