typst / svg2pdf

Converts SVG files to PDF.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example for `convert_tree_into` does not compile

adriaanmeuris opened this issue · comments

The example for convert_tree_into fails to compile with the following error:

40  |     let tree = usvg::Tree::from_str(&svg, &usvg::Options::default()).unwrap();
    |                --------------------       ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&OptionsRef<'_>`, found `&Options`
    |                |
    |                arguments to this function are incorrect
    |

I'm using the depencies listed for version 0.4.1:

[dependencies]
pdf-writer = "0.6.0"
svg2pdf = "0.4.1"
usvg = "0.22.0"

I tried updating all crates:

[dependencies]
pdf-writer = "0.7.1"
svg2pdf = "0.4.1"
usvg = "0.33.0"

But then it seems there's a mismatch between types when compiling:

    |
47  |     svg2pdf::convert_tree_into(&tree, svg2pdf::Options::default(), &mut writer, svg_id);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^                                     -----------  ------ expected `pdf_writer::object::Ref`, found `pdf_writer::Ref`
    |                                                                    |
    |                                                                    expected `pdf_writer::PdfWriter`, found `PdfWriter`
    |

Could the library be updated to work with last versions of pdf-writer and usvg available?

I released svg2pdf 0.5.0 which is compatible with the example.