diff options
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"); +} |