Crate quill_delta_pdf
source ·Expand description
Parse and convert Quill’s Deltas to PDF documents.
Calling DeltaPdf::new()
will parse the data according to the
Quill Delta specification and return an error if the delta
is invalid or has unsupported attributes.
The following attributes are supported:
- bold
- italic
- header
- list
- image
Only inserts are rendered. Deletes and retains are parsed but ignored.
§Example Usage
fn main() -> Result<(), Box<dyn std::error::Error>> {
let default_font = genpdf::fonts::from_files("./fonts", "Inter", None)?;
let mut doc = genpdf::Document::new(default_font);
let test = std::fs::read_to_string("./test.json")?;
let mut delta = quill_delta_pdf::DeltaPdf::new(test)?;
delta.set_image_dir("./images".into());
delta.write_to_pdf(&mut doc)?;
doc.render_to_file("test.pdf")?;
Ok(())
}
This library makes use of genpdf. If you want to customize the look of the PDF file feel free to take a look at their documentation
Modules§
Structs§
- Struct that holds the parsed Delta.
Enums§
- Error type for DeltaPdf