UNPKG

@adobe/pdfservices-node-sdk

Version:

The Adobe PDF Services Node.js SDK provides APIs for creating, combining, exporting and manipulating PDFs.

60 lines 2.33 kB
"use strict"; /* * Copyright 2024 Adobe * All Rights Reserved. * * NOTICE: Adobe permits you to use, modify, and distribute this file in * accordance with the terms of the Adobe license agreement accompanying * it. If you have received this file from a source other than Adobe, * then your use, modification, or distribution of it requires the prior * written permission of Adobe. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.RotatePagesParams = void 0; const ObjectUtil_1 = require("../../../internal/util/ObjectUtil"); const PageRanges_1 = require("../PageRanges"); const RotatePageAction_1 = require("../../../internal/dto/request/pagemanipulation/RotatePageAction"); const ValidationUtil_1 = require("../../../internal/util/ValidationUtil"); /** * Parameters to rotate pages of a PDF using {@link RotatePagesJob}. */ class RotatePagesParams { /** * Constructs a new `RotatePagesParams` instance. */ constructor() { this._pageActions = []; } /** * Sets the {@link Angle} to be used for rotating pages specified in {@link PageRanges}. * * @param angle - The angle to rotate pages by. Cannot be undefined. * @param [pageRanges] - The page ranges to be used for rotating pages. If not specified, all pages are included. * @returns this `RotatePagesParams` instance. */ setAngleToRotatePagesBy(angle, pageRanges) { ObjectUtil_1.ObjectUtil.requireNonNullOrUndefined(angle, "Rotate angle"); ObjectUtil_1.ObjectUtil.requireNonNull(pageRanges, "Page ranges"); if (ObjectUtil_1.ObjectUtil.isUndefined(pageRanges)) { // eslint-disable-next-line no-param-reassign pageRanges = new PageRanges_1.PageRanges().addAll(); } pageRanges?.validate(); this._pageActions.push(new RotatePageAction_1.RotatePageAction(angle, pageRanges.ranges)); return this; } /** * @hidden */ validate() { ValidationUtil_1.ValidationUtil.validateRotatePageActions(this._pageActions); } /** * @internal Used internally by this SDK, not intended to be called by clients. */ get pageActions() { return this._pageActions; } } exports.RotatePagesParams = RotatePagesParams; //# sourceMappingURL=RotatePagesParams.js.map