diff options
author | Sebastian <sebasjm@gmail.com> | 2022-06-24 13:27:39 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-06-24 13:27:39 -0300 |
commit | cc01417a9983111fed775d80edef53e07f25aa9d (patch) | |
tree | a5782048e1030c89202320a66c6488f81fbb926e /packages/anastasis-webui/src/pages | |
parent | c239967813be8a65d649e4cadd4d531fd4e4990d (diff) | |
download | wallet-core-cc01417a9983111fed775d80edef53e07f25aa9d.tar.xz |
fix #7090 dowload personal info as PDF
Diffstat (limited to 'packages/anastasis-webui/src/pages')
-rw-r--r-- | packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx index ed46aa095..228186a2d 100644 --- a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx @@ -94,6 +94,25 @@ export function AttributeEntryScreen(): VNode { }); }; + function saveAsPDF(): void { + const printWindow = window.open("", "", "height=400,width=800"); + const divContents = document.getElementById("printThis"); + const styleContents = document.getElementById("style-id"); + + if (!printWindow || !divContents || !styleContents) return; + printWindow.document.write( + "<html><head><title>Anastasis Recovery Document</title><style>", + ); + printWindow.document.write(styleContents.innerHTML); + printWindow.document.write("</style></head><body> </body></html>"); + printWindow.document.close(); + printWindow.document.body.appendChild(divContents.cloneNode(true)); + printWindow.addEventListener("load", () => { + printWindow.print(); + printWindow.close(); + }); + } + return ( <AnastasisClientFrame title={withProcessLabel(reducer, "Who are you?")} @@ -112,11 +131,16 @@ export function AttributeEntryScreen(): VNode { You personal information is used to define the location where your secret will be safely stored. If you forget what you have entered or if there is a misspell you will be unable to recover your secret. + <p> + <a onClick={saveAsPDF}>Save the personal information as PDF</a> + </p> </ConfirmModal> - ) : null} + ) : undefined} <div class="columns" style={{ maxWidth: "unset" }}> - <div class="column">{fieldList}</div> + <div class="column" id="printThis"> + {fieldList} + </div> <div class="column"> <p>This personal information will help to locate your secret.</p> <h1 class="title">This stays private</h1> |