Replies: 1 comment 1 reply
-
Hi Laurent Im not familiar with ASP, but I assume it should be able to import it normally. I have just realised that the snipped you tried to use from the readme is not valid HTML. -<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/swissqrbill/lib/browser/bundle/index.js" />
+<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/swissqrbill/lib/browser/bundle/index.js" ></script> You don't need any additional import statement, because you are importing the library with this script tag. After that, there is a global variable named Because there is no file system in the browser, we need to write the output into a buffer. You can use the built in You can then convert the buffer into a url using Here you have a minimal working example: <head>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/swissqrbill/lib/browser/bundle/index.js" ></script>
<script type="text/javascript">
const data = {
currency: "CHF",
amount: 1199.95,
reference: "210000000003139471430009017",
creditor: {
name: "Robert Schneider AG",
address: "Rue du Lac",
buildingNumber: "1268",
zip: 2501,
city: "Biel",
account: "CH4431999123000889012",
country: "CH"
},
debtor: {
name: "Pia-Maria Rutschmann-Schnyder",
address: "Grosse Marktgasse",
buildingNumber: "28",
zip: 9400,
city: "Rorschach",
country: "CH"
}
};
const stream = new SwissQRBill.BlobStream();
const pdf = new SwissQRBill.PDF(data, stream);
pdf.on("finish", () => {
const iframe = document.getElementById("iframe");
const url = stream.toBlobURL("application/pdf");
// To load in the iframe
iframe.src = url;
// To load in the current window
// window.location.href = url
});
</script>
</head>
<body>
<iframe id="iframe"></iframe>
</body> Let me know if you need any further assistance. |
Beta Was this translation helpful? Give feedback.
-
Hi Roger,
I'm looking for the right syntax to add the SwissQRBill library in my ASP application (old ERP with a mix of VBScript and javascript). I have added the pre-bundled library
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/swissqrbill/lib/browser/bundle/index.js" />
but then I'm not able to use it. Theimport { PDF } from "swissqrbill/pdf";
doesn't work and I don't know which other syntax I should use. Is it possible to use it in ASP and what should be the correct syntax ?Thanks,
Laurent
swissbill.asp.txt
Beta Was this translation helpful? Give feedback.
All reactions