UNPKG

pdf-lib

Version:

Library for creating and modifying PDF files in JavaScript

43 lines (42 loc) 1.87 kB
"use strict"; 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 __()); }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; } Object.defineProperty(exports, "__esModule", { value: true }); /* eslint-disable new-cap */ var PDFOperator_1 = __importDefault(require("../../../pdf-operators/PDFOperator")); var utils_1 = require("../../../../utils"); var validate_1 = require("../../../../utils/validate"); /** * Set the character spacing, Tc, to charSpace, which shall be a number * expressed in unscaled text space units. * Character spacing shall be used by the Tj, TJ, and ' operators. * Initial value: 0. */ var Tc = /** @class */ (function (_super) { __extends(Tc, _super); function Tc(charSpace) { var _this = _super.call(this) || this; _this.toString = function () { return _this.charSpace + " Tc\n"; }; _this.bytesSize = function () { return _this.toString().length; }; _this.copyBytesInto = function (buffer) { return utils_1.addStringToBuffer(_this.toString(), buffer); }; validate_1.validate(charSpace, validate_1.isNumber, 'Tc operator arg "charSpace" must be a number.'); _this.charSpace = charSpace; return _this; } Tc.of = function (charSpace) { return new Tc(charSpace); }; return Tc; }(PDFOperator_1.default)); exports.default = Tc;