UNPKG

@syncfusion/ej2-pdf

Version:

Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.

60 lines (59 loc) 2.2 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { _PdfDecodeStream } from '../decode-stream'; import { _PdfFaxDecoder } from '../graphics/images/pdf-fax-decoder'; import { _PdfDictionary } from '../pdf-primitives'; /** * Provides a CCITT Fax decoding stream that expands fax encoded data from the underlying source. * * @private */ var _PdfFaxStream = /** @class */ (function (_super) { __extends(_PdfFaxStream, _super); function _PdfFaxStream(str, maybeLength, params) { var _this = _super.call(this, maybeLength) || this; _this.stream = str; if (!(params instanceof _PdfDictionary)) { params = new _PdfDictionary(null); } var source = { next: function () { return str.getByte(); } }; _this.ccittFaxDecoder = new _PdfFaxDecoder(source, { K: params.get('K'), EndOfLine: params.get('EndOfLine'), EncodedByteAlign: params.get('EncodedByteAlign'), Columns: params.get('Columns'), Rows: params.get('Rows'), EndOfBlock: params.get('EndOfBlock'), BlackIs1: params.get('BlackIs1') }); return _this; } _PdfFaxStream.prototype.readBlock = function () { while (!this.eof) { var c = this.ccittFaxDecoder.readNextChar(); if (c === -1) { this.eof = true; return; } this.ensureBuffer(this.bufferLength + 1); this.buffer[this.bufferLength++] = c; } }; return _PdfFaxStream; }(_PdfDecodeStream)); export { _PdfFaxStream };