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

pdf2json

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pdf2json - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

9

lib/pdfcanvas.js

@@ -69,2 +69,3 @@ 'use strict';

o2.lineScale_ = o1.lineScale_;
o2.dashArray = o1.dashArray;
}

@@ -135,2 +136,3 @@

this.lineCap = 'butt';
this.dashArray = [];
this.miterLimit = 1;

@@ -162,3 +164,4 @@ this.globalAlpha = 1;

var _drawPDFLine = function(p1, p2, lineWidth, color) {
var pL = new PDFLine(p1.x, p1.y, p2.x, p2.y, lineWidth, color);
var dashedLine = _.isArray(this.dashArray) && (this.dashArray.length > 1);
var pL = new PDFLine(p1.x, p1.y, p2.x, p2.y, lineWidth, color, dashedLine);
pL.processLine(this.canvas);

@@ -180,2 +183,6 @@ };

contextPrototype.setLineDash = function(lineDash) {
this.dashArray = lineDash;
};
contextPrototype.fillText = function(text, x, y, maxWidth, fontSize) {

@@ -182,0 +189,0 @@ var str = text.trim();

@@ -215,2 +215,3 @@ var nodeUtil = require("util"),

case 70: retVal = '\u007D'; break; //right curly bracket
case 52: retVal = '\u25b6'; break; //right triangle. sample: dc_scr_fr147 item4
case 71: retVal = '\u25b6'; break; //right triangle

@@ -217,0 +218,0 @@ case 103: retVal = '\u27A8'; break; //right arrow. sample: va_ind_760pff and pmt

13

lib/pdfline.js

@@ -12,3 +12,3 @@ var nodeUtil = require("util"),

// constructor
var cls = function (x1, y1, x2, y2, lineWidth, color) {
var cls = function (x1, y1, x2, y2, lineWidth, color, dashed) {
// private

@@ -27,2 +27,3 @@ var _id = _nextId++;

this.color = color;
this.dashed = dashed;
};

@@ -44,2 +45,3 @@

var yDelta = Math.abs(this.y2 - this.y1);
var minDelta = 3 * this.lineWidth;

@@ -57,3 +59,8 @@ var oneLine = {x:0, y:0, w:this.lineWidth, l:0};

if (yDelta < 0.5) { //HLine
//MQZ Aug.29 dashed line support
if (this.dashed) {
oneLine = _.extend({dsh: 1}, oneLine);
}
if ((yDelta < this.lineWidth) && (xDelta > minDelta)) { //HLine
oneLine.l = PDFUnit.toFormX(xDelta);

@@ -66,3 +73,3 @@ if (this.x1 > this.x2)

}
else if (xDelta < 0.5) {//VLine
else if ((xDelta < this.lineWidth) && (yDelta > minDelta)) {//VLine
oneLine.l = PDFUnit.toFormY(yDelta);

@@ -69,0 +76,0 @@ if (this.y1 > this.y2)

{
"name": "pdf2json",
"_id": "pdf2json@0.4.3",
"version": "0.4.3",
"_id": "pdf2json@0.4.4",
"version": "0.4.4",
"description": "A PDF file parser that converts PDF binaries to text based JSON, powered by porting a fork of PDF.JS to Node.js",

@@ -6,0 +6,0 @@ "keywords": [

@@ -79,3 +79,5 @@ Introduction

* 'HLines': horizontal line array, each line has 'x', 'y' in relative coordinates for positioning, and 'w' for width, plus 'l' for length. Both width and length are in page unit
* 'Vline': vertical line array, each line has 'x', 'y' in relative coordinates for positioning, and 'w' for width, plus 'l' for length. Both width and length are in page unit; v0.4.3 added Line color support, it's default to black, other wise set in 'clr' if found in color dictionary, or 'oc' field if not found in dictionary;
* 'Vline': vertical line array, each line has 'x', 'y' in relative coordinates for positioning, and 'w' for width, plus 'l' for length. Both width and length are in page unit;
* v0.4.3 added Line color support. Default is 'black', other wise set in 'clr' if found in color dictionary, or 'oc' field if not found in dictionary;
* v0.4.4 added dashed line support. Default is 'solid', if line style is dashed line, {dsh:1} is added to line object;
* 'Fills': an array of rectangular area with solid color fills, same as lines, each 'fill' object has 'x', 'y' in relative coordinates for positioning, 'w' and 'h' for width and height in page unit, plus 'clr' to reference a color with index in color dictionary. More info about 'color dictionary' can be found at 'Dictionary Reference' section.

@@ -82,0 +84,0 @@ * 'Texts': an array of text blocks with position, actual text and styling informations:

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