cross-platform-pdf-generator
Advanced tools
Comparing version 0.0.9 to 0.1.0
23
main.js
import { createPDFFromJSON } from "./PrintService.js"; | ||
import { createPrintOrder, getPrintInstruction, prepairPrintData } from "./StorageInterpreter.js"; | ||
//import fs from 'fs'; | ||
//import values from "./PDFtemplates/values.json"; | ||
//import { runDemo } from './StorageInterpreter.js'; | ||
/* DEBUG | ||
import fs from 'fs'; | ||
import values from "./PDFtemplates/values.json"; | ||
import { runDemo } from './StorageInterpreter.js'; | ||
*/ | ||
//Public interface | ||
@@ -75,7 +78,9 @@ | ||
*/ | ||
export function CreatePrintOrder(instructions, data, other) { | ||
export function printServiceCreatePrintOrder(instructions, data, other) { | ||
return createPrintOrder(instructions, data, other); | ||
} | ||
/* | ||
/* DEBUG | ||
function saveFile(name, bytes) { | ||
@@ -93,5 +98,7 @@ return new Promise((resolve, rejects) => { | ||
} | ||
*/ | ||
//const bytes = await runDemo(values); | ||
//await saveFile("test", bytes); | ||
const bytes = await runDemo(values); | ||
await saveFile("test", bytes); | ||
*/ |
{ | ||
"name": "cross-platform-pdf-generator", | ||
"version": "0.0.9", | ||
"version": "0.1.0", | ||
"description": "pulsation pdg generator for web and ios", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
import { PDFDocument, StandardFonts, rgb, PDFFont, PDFPage, PDFTextField } from 'pdf-lib'; | ||
import { Box } from "./utils/Box.js"; | ||
//import fs from 'fs'; | ||
import Img from "./ressources/img.json"; | ||
@@ -44,2 +44,11 @@ /** | ||
const settings = Object.assign( | ||
{ | ||
"valueSpacing": 8, | ||
"fontSize": 11, | ||
"lineHeight": 1.4 | ||
}, | ||
json?.documentSettings?.textSettings | ||
); | ||
if (template != null) { | ||
@@ -61,11 +70,2 @@ const pdfDoc = await PDFDocument.load(template); | ||
const settings = Object.assign( | ||
{ | ||
"valueSpacing": 8, | ||
"fontSize": 11, | ||
"lineHeight": 1.4 | ||
}, | ||
json?.documentSettings?.textSettings | ||
); | ||
await fillPDFDocument(pdfDoc, firstPage, data, insets, initInsets, settings); | ||
@@ -78,3 +78,4 @@ await printFooter(pdfDoc, json); | ||
const pdfDoc = await PDFDocument.create() | ||
await fillPDFDocument(pdfDoc, generateFakeData()); | ||
const page = pdfDoc.addPage(); | ||
await fillPDFDocument(pdfDoc, page, data, insets, initInsets, settings); | ||
const pdfBytes = await pdfDoc.save(); | ||
@@ -426,6 +427,6 @@ return pdfBytes; | ||
const font = await document.embedFont(StandardFonts.Helvetica); | ||
//const img = await loadFile("./ressources/pulsation.png"); | ||
const img = Img.pulsation; | ||
//create PDF Img | ||
//const jpgImage = await document.embedPng(img); | ||
const jpgImage = await document.embedPng(img); | ||
@@ -432,0 +433,0 @@ let i = 1; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
747893
20
8222