Crates.io | json2pdf-client |
lib.rs | json2pdf-client |
version | 0.1.0 |
source | src |
created_at | 2022-06-20 17:11:31.534106 |
updated_at | 2022-06-20 17:11:31.534106 |
description | Client library for the json2pdf server |
homepage | |
repository | https://github.com/TobiasDeBruijn/json2pdf |
max_upload_size | |
id | 609678 |
size | 15,030 |
Rust Client library for the json2pdf server. Json2pdf is a server which takes a JSON description of a PDF, and converts it to a PDF document.
use json2pdf_client::*;
/// Generate a PDF document containing a paragraph and an image
async fn generate_pdf() {
let spec = DocumentSpecification::new()
.add_element(Element::paragraph(Paragraph::new("Hello world!"))
.border(BorderSettings::new()
.bottom(BorderSpecification::new(4f32))))
// Make sure you add the actual image bytes, rather than an empty Vec
.add_element(Element::image(Image::new_bytes(&Vec::new(), 400f32, 400f32)));
let data = pdf("http://localhost:8080", &spec).await.unwrap();
}
json2pdf-client is licensed under the Apache-2.0 license, or the MIT license. At your discretion. Both licenses can be found at the root of this repository.