From bcdfeb3d4e2569e073a34be67f38f57da90be723 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Tue, 9 Mar 2021 21:32:18 +0100 Subject: Use LinearLayout for vcard --- examples/cli.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 examples/cli.rs (limited to 'examples') 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"); +} -- cgit v1.2.3