diff --git a/dist/package.json b/dist/package.json index 9b726f1..e056b91 100644 --- a/dist/package.json +++ b/dist/package.json @@ -1,6 +1,6 @@ { "name": "jspdf-product-label-54x70", - "version": "1.2.10", + "version": "1.3.0", "main": "src/app.js", "author": "André Kelling", "description": "Dymo Label PDF printing 54 x 70mm.", diff --git a/src/print/index.d.ts b/src/print/index.d.ts index fdf79d3..31b9094 100644 --- a/src/print/index.d.ts +++ b/src/print/index.d.ts @@ -10,4 +10,4 @@ declare interface PrintData { productId?: string } -export declare function printPDF(printData: PrintData[]): JsPDF; +export declare function printPDF(printData: PrintData[], asBlob?: boolean): JsPDF; diff --git a/src/print/index.js b/src/print/index.js index b9e2441..7cedeff 100644 --- a/src/print/index.js +++ b/src/print/index.js @@ -10,9 +10,10 @@ import assembleFileName from "./utils/file-name.js"; /** * @param {PrintData[]} printDataArr + * @param {boolean} asBlob if true, returns the pdf as a blob * @returns {JsPDF} */ -export default (printDataArr) => { +export default (printDataArr, asBlob = false) => { const options = { orientation: 'p', format: [54, 70] @@ -52,5 +53,5 @@ export default (printDataArr) => { // <><>><><>><>><><><><><>>><><<><><><><> const fileName = assembleFileName(printDataArr.length, printDataArr[0]); - return doc.save(fileName + ".pdf"); + return asBlob ? doc.output('blob') : doc.save(fileName + ".pdf"); }