use crate::pdfgen; use wasm_bindgen::prelude::*; use js_sys; use yew::prelude::*; struct Form { } impl Component for Form { type Message = (); type Properties = (); fn create(_props: Self::Properties, _link: ComponentLink) -> Self { Self { } } fn update(&mut self, _msg: Self::Message) -> ShouldRender { false } fn change(&mut self, _props: Self::Properties) -> ShouldRender { false } fn view(&self) -> Html { let raw = pdfgen::genpdf(); let data = base64::encode(&raw); let uri_component: String = js_sys::encode_uri_component(&data).into(); let href = format!{"data:application/pdf;base64,{}", uri_component }; html!{ { "Download PDF" } } } } #[wasm_bindgen(start)] pub fn run_app() { App::
::new().mount_to_body(); }