diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2021-03-09 21:32:18 +0100 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2021-03-09 21:32:18 +0100 |
commit | bcdfeb3d4e2569e073a34be67f38f57da90be723 (patch) | |
tree | 918fe2f00bf4eefb373afbbe9d10e522c80086d2 /examples | |
parent | 4d2edd797d5f8054284bc990371f28e918ea044b (diff) | |
download | wasm-card-main.tar.gz wasm-card-main.tar.bz2 |
Use LinearLayout for vcardmain
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cli.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/cli.rs b/examples/cli.rs new file mode 100644 index 0000000..7e5e6db --- /dev/null +++ b/examples/cli.rs @@ -0,0 +1,28 @@ +use wasm_card::model::property_groups::address::Address; +use wasm_card::model::property_groups::name::Name; +use wasm_card::model::property_groups::telephone::Telephone; +use wasm_card::model::vcard; + +fn main() { + let mut data = vcard::VCardData::new(); + data.add_name(Name { + first_name: "John".to_owned(), + last_name: "Doe".to_owned(), + ..Default::default() + }); + data.add_telephone(Telephone { + number: "+49 123 45678".to_owned(), + cell: true, + ..Default::default() + }); + data.add_address(Address { + street: "Musterweg 1".to_owned(), + code: "12345".to_owned(), + locality: "Musterhausen".to_owned(), + country: "Germany".to_owned(), + ..Default::default() + }); + + let pdf = data.generate_pdf().expect("Failed to generate PDF"); + std::fs::write("output.pdf", &pdf).expect("Failed to write PDF file"); +} |