pdf-lib
Version:
Library for creating and modifying PDF files in JavaScript
37 lines (36 loc) • 1.62 kB
JavaScript
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 __());
};
})();
/* tslint:disable:max-classes-per-file class-name */
import PDFOperator from '../../../pdf-operators/PDFOperator';
import { addStringToBuffer } from '../../../../utils';
import { isInRange, validate } from '../../../../utils/validate';
/**
* Set the flatness tolerance in the graphics state.
* flatness is a number in the * range 0 to 100; a value of 0 shall specify the
* output device’s default flatness tolerance.
*/
var i = /** @class */ (function (_super) {
__extends(i, _super);
function i(flatness) {
var _this = _super.call(this) || this;
_this.toString = function () { return _this.flatness + " i\n"; };
_this.bytesSize = function () { return _this.toString().length; };
_this.copyBytesInto = function (buffer) {
return addStringToBuffer(_this.toString(), buffer);
};
validate(flatness, isInRange(0, 100), 'i operator arg "flatness" must be a number from 0 to 100.');
_this.flatness = flatness;
return _this;
}
i.of = function (flatness) { return new i(flatness); };
return i;
}(PDFOperator));
export default i;