Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

btrz-pdf

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

btrz-pdf - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

src/toletters.js

5

package.json
{
"name": "btrz-pdf",
"version": "1.5.0",
"version": "1.6.0",
"description": "Generates pdf documents based on a liquid template",

@@ -29,3 +29,4 @@ "main": "src/index.js",

"pdfmake": "^0.2.4",
"symbology": "^3.0.8"
"symbology": "^3.0.8",
"written-number": "^0.11.1"
},

@@ -32,0 +33,0 @@ "devDependencies": {

2

src/index.js

@@ -10,2 +10,3 @@ const {Liquid} = require("liquidjs");

const {QrString} = require("./qrstr.js");
const {ToLetters} = require("./toletters.js");
const {createPdfBinary, createPdfKitDocument, defaultDocumentDefinition} = require("./pdf.js");

@@ -81,2 +82,3 @@ const pdfjs = require("pdfjs");

engine.plugin(QrString);
engine.plugin(ToLetters);
const str = await engine.parseAndRender(liquidTemplate, data);

@@ -83,0 +85,0 @@ // console.log(str);

@@ -99,3 +99,6 @@ describe("index.js", () => {

fare: "adult",
total: 2800000,
total: 2836000,
displayTotalStr: "28.36",
"displayTotalStr2": "289",
"displayTotalStr3": "289.00",
taxes: [],

@@ -131,3 +134,4 @@ ssrs: [

}
}
},
lang: "es-ar"
}

@@ -219,2 +223,21 @@ });

it("should return currency in letters", async () => {
const pdf = require("../src/index");
const template = `{
"content": [
"{% toLetters ticket.displayTotalStr %}",
"{% toLetters ticket.displayTotalStr2 %}",
"{% toLetters ticket.displayTotalStr3 %}"
]
}`;
const documentDefinition = await pdf.toDocumentDefinition(template, data);
expect(documentDefinition).to.be.eql({
"content": [
"veintiocho =>with treinta y seis =>cents",
"doscientos ochenta y nueve",
"doscientos ochenta y nueve"
]
})
});
it("should return a parsed liquidTemplate", async () => {

@@ -256,29 +279,21 @@ const pdf = require("../src/index");

"Transaction Id: 5c9f8f8f8f8f8f8f8f8f8f8",
"=>h",
"adult and =>adult",
"child and =>child",
"person and =>person",
{
"svg": "<svg height='2' width='100'><line x1='0' y1='0' x2='1000' y2='0' style='stroke:rgb(60,60,60);stroke-width:2' /></svg>",
"width": 356
},
{
"svg": "<svg height='2' width='100'><line x1='0' y1='0' x2='1000' y2='0' style='stroke:rgb(0,0,0);stroke-width:1' /></svg>",
"width": 500
},
{
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA3gAAAB4CAYAAACghlDTAAAAAklEQVR4AewaftIAAAPmSURBVO3BsW0EQQwEsJH673mcbnSA8ZlAcpI0H9rmNTN5tc2XmcmrbX4xM/nSNr+Ymbza5jUzebXNl5nJq23+Y2byi7Z5zUxebfOambza5svM5Bdt85qZvNrmy8zk1TZfZiZf2uY1M/mPtvkyM3m1zS9mJq+2ec1MvrTNl5nJq23+Y2byi7Z5zUxebfOamXxpm1/MTF5t85qZvNrmy8zk1TZfZia/aJvXzOTVNl9mJq+2ec1MvrTNl5nJq21+MTP50ja/mJm82uY1M3m1zZeZyattvsxMftE2r5nJq22+zExebfNlZvKlbV4zk/9omy8zk1fbfJmZfGmb18zk1Ta/mJm82uYXM5MvbfOambza5svM5Bdt85qZvNrmy8zk1TZfZiavtnnNTL60zZeZyattfjEz+dI2v5iZvNrmNTN5tc2XmcmXtvkyM/nSNl9mJl/a5jUz+dI2/zEz+Y+2ec1MXm3zmpl82QAAAHDCBgAAgBM2AAAAnLABAADghA0AAAAnbAAAADhhAwAAwAkbAAAATtgAAABwwgYAAIATNgAAAJywAQAA4IQNAAAAJ2wAAAA4YQMAAMAJGwAAAE7YAAAAcMIGAACAEzYAAACcsAEAAOCEDQAAACdsAAAAOGEDAADACRsAAABO2AAAAHDCBgAAgBM2AAAAnLABAADghA0AAAAnbAAAADhhAwAAwAkbAAAATtgAAABwwgYAAIATNgAAAJywAQAA4IQNAAAAJ2wAAAA4YQMAAMAJGwAAAE7YAAAAcMIGAACAEz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"bold": true, "text": "html"},{"text": ""},{"italics": true, "text": "Italix"},
"28.00",
"=>h","adult and =>adult","child and =>child","person and =>person",{
"svg": "<svg height='2' width='100'><line x1='0' y1='0' x2='1000' y2='0' style='stroke:rgb(60,60,60);stroke-width:2' /></svg>",
"width": 356
},{
"svg": "<svg height='2' width='100'><line x1='0' y1='0' x2='1000' y2='0' style='stroke:rgb(0,0,0);stroke-width:1' /></svg>",
"width": 500
},{
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA3gAAAB4CAYAAACghlDTAAAAAklEQVR4AewaftIAAAPmSURBVO3BsW0EQQwEsJH673mcbnSA8ZlAcpI0H9rmNTN5tc2XmcmrbX4xM/nSNr+Ymbza5jUzebXNl5nJq23+Y2byi7Z5zUxebfOambza5svM5Bdt85qZvNrmy8zk1TZfZiZf2uY1M/mPtvkyM3m1zS9mJq+2ec1MvrTNl5nJq23+Y2byi7Z5zUxebfOamXxpm1/MTF5t85qZvNrmy8zk1TZfZia/aJvXzOTVNl9mJq+2ec1MvrTNl5nJq21+MTP50ja/mJm82uY1M3m1zZeZyattvsxMftE2r5nJq22+zExebfNlZvKlbV4zk/9omy8zk1fbfJmZfGmb18zk1Ta/mJm82uYXM5MvbfOambza5svM5Bdt85qZvNrmy8zk1TZfZiavtnnNTL60zZeZyattfjEz+dI2v5iZvNrmNTN5tc2XmcmXtvkyM/nSNl9mJl/a5jUz+dI2/zEz+Y+2ec1MXm3zmpl82QAAAHDCBgAAgBM2AAAAnLABAADghA0AAAAnbAAAADhhAwAAwAkbAAAATtgAAABwwgYAAIATNgAAAJywAQAA4IQNAAAAJ2wAAAA4YQMAAMAJGwAAAE7YAAAAcMIGAACAEzYAAACcsAEAAOCEDQAAACdsAAAAOGEDAADACRsAAABO2AAAAHDCBgAAgBM2AAAAnLABAADghA0AAAAnbAAAADhhAwAAwAkbAAAATtgAAABwwgYAAIATNgAAAJywAQAA4IQNAAAAJ2wAAAA4YQMAAMAJGwAAAE7YAAAAcMIGA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},{"bold": true, "text": "html"},{"text": ""},{"italics": true, "text": "Italix"},
"28.36",
"$",
"CAD",
"59.00",
"Tue Dec 21, 2021 11:38 AM",
"Tue Dec 21, 2021",
"Mar Dic 21, 2021 11:38 AM",
"Mar Dic 21, 2021",
"12/21/2021 11:38 AM",

@@ -288,8 +303,4 @@ "12/21/2021 11:38:00",

"11:38 AM",
{"text": "something here"},
{"text": "and some more here"},
{"text": "and some more here"},
{"text": "something here", "style": "small"},
{"text": "and some more here", "style": "small"},
{"text": "and some more here", "style": "small"}
{"text": "something here"},{"text": "and some more here"},{"text": "and some more here"},
{"text": "something here", "style": "small"},{"text": "and some more here", "style": "small"},{"text": "and some more here", "style": "small"}
]

@@ -296,0 +307,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc