-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
112 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"prettier": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<script | ||
type="text/javascript" | ||
src="https://cdn.jsdelivr.net/npm/pdfkit@0/js/pdfkit.standalone.js" | ||
></script> | ||
<script | ||
type="text/javascript" | ||
src="https://cdn.jsdelivr.net/npm/[email protected]/+esm" | ||
></script> | ||
<script | ||
type="text/javascript" | ||
src="https://cdn.jsdelivr.net/npm/[email protected]/lib/pdf/swissqrbill.js" | ||
></script> | ||
<script type="module" src="./src/script.js"></script> | ||
</head> | ||
<body> | ||
<iframe id="iframe"></iframe> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const data = { | ||
creditor: { | ||
account: "CH58 0079 1123 0008 8901 2", | ||
address: "Creditor Address", | ||
city: "Creditor City", | ||
country: "CH", | ||
name: "Creditor FirstName LastName", | ||
zip: 1234 | ||
}, | ||
currency: "CHF" | ||
}; | ||
|
||
const pdf = new PDFDocument({ size: "A4" }); | ||
const stream = pdf.pipe(blobStream()); | ||
const qrBill = new SwissQRBill(data); | ||
|
||
stream.on("finish", () => { | ||
const url = stream.toBlobURL("application/pdf"); | ||
iframe.src = url; | ||
}); | ||
|
||
qrBill.attachTo(pdf); | ||
pdf.end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": [ | ||
"vite.config.ts", | ||
"vite.config.bundle.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { config, defineConfig } from "@schoero/vite-config"; | ||
|
||
|
||
/** @type {import('vitest/config').UserConfig} */ | ||
export default defineConfig({ | ||
...config, | ||
build: { | ||
emptyOutDir: false, | ||
lib: { | ||
entry: "src/svg/swissqrbill.ts", | ||
fileName: "bundle", | ||
formats: ["es"] | ||
}, | ||
minify: true, | ||
outDir: "lib", | ||
target: "es6" | ||
}, | ||
plugins: [ | ||
...config.plugins ?? [] | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters