UNPKG

pdf-lib

Version:

Library for creating and modifying PDF files in JavaScript

36 lines (35 loc) 1.53 kB
var __extends = (this && this.__extends) || (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* eslint-disable new-cap */ import PDFOperator from '../../../pdf-operators/PDFOperator'; import { addStringToBuffer } from '../../../../utils'; import { isNumber, validate } from '../../../../utils/validate'; /** * Set the horizontal scaling, Th, to (scale ÷ 100). scale shall be a number * specifying the percentage of the normal width. Initial value: 100 (normal width). */ var Tz = /** @class */ (function (_super) { __extends(Tz, _super); function Tz(scale) { var _this = _super.call(this) || this; _this.toString = function () { return _this.scale + " Tz\n"; }; _this.bytesSize = function () { return _this.toString().length; }; _this.copyBytesInto = function (buffer) { return addStringToBuffer(_this.toString(), buffer); }; validate(scale, isNumber, 'Tz operator arg "scale" must be a number.'); _this.scale = scale; return _this; } Tz.of = function (scale) { return new Tz(scale); }; return Tz; }(PDFOperator)); export default Tz;