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

cross-platform-pdf-generator

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-platform-pdf-generator - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "cross-platform-pdf-generator",
"version": "1.0.1",
"version": "1.0.2",
"description": "pulsation pdg generator for web and ios",

@@ -5,0 +5,0 @@ "main": "main.js",

@@ -63,2 +63,5 @@ import { PDFDocument, StandardFonts, rgb, PDFFont, PDFPage, PDFTextField } from 'pdf-lib';

//Clean and remove emty section from Data
data = cleanData(data)
//handle floating text

@@ -99,5 +102,6 @@

const name = field.getName();
const value = data.find(v => v.title === name);
const dataID = data?.id
const value = data.find(v => v.title === name || v.title === dataID);
if (value?.value === undefined) continue;
unhandeld = unhandeld.filter(e => name !== e.title);
unhandeld = unhandeld.filter(e => name !== e.title && dataID !== e.title);
await drawTextInField(value, field, document);

@@ -109,2 +113,30 @@ }

export function cleanData(data) {
if (!Array.isArray(data)) return data
let cleaned = []
let maxIndex = data.length-1
for(let i = 0; i<data.length; i++) {
let object = data[i]
let textIndex = 0
if (object.type === "section") {
textIndex = i + 2
}else if (object.type === "subSection") {
textIndex = i + 1
}else {
cleaned.push(object)
continue
}
if (textIndex > maxIndex) continue
if (data[textIndex].type !== "text") continue
cleaned.push(object)
}
return cleaned
}
async function fillPDFDocument(document, page, values, insets, initInsets, settings) {

@@ -111,0 +143,0 @@ if (!(document instanceof PDFDocument) || !Array.isArray(values)) return;

import { GenericStorage } from "./utils/GenericUtils/GenericStorage.js";
import { GenericViewRepresentation, GenericRow, GenericSection } from "./utils/GenericUtils/GenericView.js";
import { createPDFFromJSON } from "./PrintService.js";
import { cleanData, createPDFFromJSON } from "./PrintService.js";
import { getValueFromStorage } from "./utils/GenericUtils/GenericStorageManager.js";

@@ -197,2 +197,3 @@ import { generateGVR, generateRoot } from "./utils/GenericUtils/MultinavigationManager.js";

{
"id": r.row_id,
"type": "text",

@@ -199,0 +200,0 @@ "title": rowName,

import { sha256 } from 'js-sha256';
import ByteBuffer from "bytebuffer";

@@ -11,7 +10,4 @@ export function generateUUIDFrom(string) {

let buffer = new ByteBuffer();
buffer.writeCString(uuidSeed, 0);
const hash = sha256.array(uuidSeed);
const hash = sha256.array(buffer.buffer.slice(0, byteCount));
const truncateBytes = hash.slice(0, 16);

@@ -18,0 +14,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