Add more text information, closes #8

This commit is contained in:
Michal Szczepanski 2019-07-28 15:10:06 +02:00
parent c74c037d2a
commit a28f9d997f
3 changed files with 12 additions and 8 deletions

@ -1,5 +1,5 @@
const PdfObject = require('./PdfObject');
const util = require('pdfjs-dist/lib/shared/util');
/**
* Holds PDF page information
* @extends {PdfObject}
@ -25,6 +25,7 @@ class PdfPage extends PdfObject {
this.wordSpacing = 0;
this.textHScale = 1;
this.textRise = 0;
this.textRenderingMode = util.TextRenderingMode.FILL;
this.currentObject = null;
this.currentFont = null;

@ -1,4 +1,3 @@
const util = require('pdfjs-dist/lib/shared/util');
const Constraints = require('../Constraints');
const PdfObject = require('./PdfObject');
const TextLine = require('./text/TextLine');
@ -14,7 +13,6 @@ class TextObject extends PdfObject {
constructor () {
super();
this.textMatrix = Constraints.IDENTITY_MATRIX;
this.textRenderingMode = util.TextRenderingMode.FILL;
this.lineMatrix = Constraints.IDENTITY_MATRIX;
this.textMatrixScale = 1;
this._textLines = [];

@ -101,7 +101,8 @@ class VisitorText extends VisitorBase {
*/
setCharSpacing (args) {
if (this.config.debug) console.log('setCharSpacing');
// if (this.config.skip) return;
if (this.config.skip) return;
this.page.charSpacing = args[0];
}
/**
@ -109,7 +110,8 @@ class VisitorText extends VisitorBase {
*/
setWordSpacing (args) {
if (this.debug) console.log('setWordSpacing');
// if (this.config.skip) return;
if (this.config.skip) return;
this.page.wordSpacing = args[0];
}
/**
@ -117,7 +119,8 @@ class VisitorText extends VisitorBase {
*/
setHScale (args) {
if (this.config.debug) console.log('setHScale');
// if (this.config.skip) return;
if (this.config.skip) return;
this.page.textHScale = args[0] / 100;
}
/**
@ -142,7 +145,8 @@ class VisitorText extends VisitorBase {
*/
setTextRise (args) {
if (this.config.debug) console.log('setTextRise');
// if (this.config.skip) return;
if (this.config.skip) return;
this.page.textRise = args[0];
}
/**
@ -150,7 +154,8 @@ class VisitorText extends VisitorBase {
*/
setTextRenderingMode (args) {
if (this.config.debug) console.log('setTextRenderingMode');
// if (this.config.skip) return;
if (this.config.skip) return;
this.page.textRenderingMode = args[0];
}
/**