receiptline / receiptline

Markdown for receipts. Printable digital receipts. Generate receipt printer commands and images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

invisible image

zakaria-chahboun opened this issue · comments

Hi! Thanks for this amazing open source project!
I use https://receiptline.github.io/designer/ to design my bill. When I downloaded the receiptline.txt and i checked it with a text editor, It' was just fine!

But!

When i used it with node.js like that:

  const doc = fs
    .readFileSync("/home/zaki/Downloads/receiptline.txt", { encoding: "utf-8" })
    .toString();

  const display = {
    cpl: 48,
    encoding: "cp437",
  };

  const svg = receiptline.transform(doc, display);
  fs.writeFileSync("/home/zaki/Documents/receiptline.svg", svg);

The image logo included in my bill is was disappeared!

I opened the SVG file with a text editor, It doesn't have the image (base64)!
It seems Like the receiptline.transform parser ignore it!
Why?

Hello! Thanks for using receiptline.

receiptline.txt has a BOM (Byte Order Mark). So please try the following.

  const doc = fs
    .readFileSync("/home/zaki/Downloads/receiptline.txt", { encoding: "utf-8" })
    .toString()
    .replace(/^\ufeff/, "");

Thanks!