schoero / swissqrbill

Swiss QR Bill generation in Node.js and browsers
MIT License
155 stars 29 forks source link

Add option to exclude scissors in SVG #420

Closed rkreienbuehl closed 8 months ago

rkreienbuehl commented 9 months ago

It would be nice to have an option to exclude scissors when creating an svg.

schoero commented 8 months ago

Thank you for the issue. I agree, SVG should have the same options available as PDF.

In SwissQRBill v4 this is now possible:

import { writeFileSync } from "node:fs";

import { SwissQRBill } from "swissqrbill/svg";

const data = {
  amount: 1994.75,
  creditor: {
    account: "CH44 3199 9123 0008 8901 2",
    address: "Musterstrasse",
    buildingNumber: 7,
    city: "Musterstadt",
    country: "CH",
    name: "SwissQRBill",
    zip: 1234
  },
  currency: "CHF",
  debtor: {
    address: "Musterstrasse",
    buildingNumber: 1,
    city: "Musterstadt",
    country: "CH",
    name: "Peter Muster",
    zip: 1234
  },
  reference: "21 00000 00003 13947 14300 09017"
};

const svg = new SwissQRBill(data, { scissors: false });

writeFileSync("svg-without-scissors.svg", svg.toString());