typst/svg2pdf

`convert_tree_into` doesn't work

J-Kappes opened this issue · 2 comments

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

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.

usvg is now reexported.