mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-12-25 00:11:36 +01:00
Use pdfmake from globals.
This commit is contained in:
parent
25ac6cf1e9
commit
bded10211a
|
@ -5,22 +5,36 @@
|
||||||
* See /LICENSE for more information.
|
* See /LICENSE for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import pdfMake from "pdfmake";
|
|
||||||
|
|
||||||
export function createAndDownloadPdf(SSID, password) {
|
export function createAndDownloadPdf(SSID, password) {
|
||||||
const docDefinition = {
|
const docDefinition = {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
text: "Wi-Fi", style: "header", fontSize: 55, alignment: "center",
|
text: "Wi-Fi",
|
||||||
|
style: "header",
|
||||||
|
fontSize: 55,
|
||||||
|
alignment: "center",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
qr: toQRCodeContent(SSID, password), fit: "350", margin: [0, 80], alignment: "center",
|
qr: toQRCodeContent(SSID, password),
|
||||||
|
fit: "350",
|
||||||
|
margin: [0, 80],
|
||||||
|
alignment: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: `SSID: ${SSID}`,
|
||||||
|
fontSize: 25,
|
||||||
|
alignment: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: `Password: ${password}`,
|
||||||
|
fontSize: 25,
|
||||||
|
alignment: "center",
|
||||||
},
|
},
|
||||||
{ text: `SSID: ${SSID}`, fontSize: 25, alignment: "center" },
|
|
||||||
{ text: `Password: ${password}`, fontSize: 25, alignment: "center" },
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
pdfMake.createPdf(docDefinition).download("wifi.pdf");
|
|
||||||
|
// pdfmake is exposed by reForis main application. Thus we can use it from globals.
|
||||||
|
window.pdfMake.createPdf(docDefinition).download("wifi.pdf");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toQRCodeContent(SSID, password) {
|
export function toQRCodeContent(SSID, password) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user