A job that deletes pages from a PDF file.

Example

Sample Usage:

        const readStream = fs.createReadStream("<SOURCE_PATH>");

const credentials = new ServicePrincipalCredentials({
clientId: process.env.PDF_SERVICES_CLIENT_ID,
clientSecret: process.env.PDF_SERVICES_CLIENT_SECRET
});

const pdfServices = new PDFServices({credentials});

const inputAsset = await pdfServices.upload({
readStream,
mimeType: MimeType.PDF
});

const pageRangeForDeletion = new PageRanges().addSinglePage(1);

const params = new DeletePagesParams({
pageRanges: pageRangeForDeletion
});

const job = new DeletePagesJob({inputAsset, params});

const pollingURL = await pdfServices.submit({job});

const pdfServicesResponse = await pdfServices.getJobResult({
pollingURL,
resultType: DeletePagesResult
});

const resultAsset = pdfServicesResponse.result.asset;
const streamAsset = await pdfServices.getContent({asset: resultAsset});

Hierarchy (view full)

Constructors

  • Constructs a new DeletePagesJob instance.

    Parameters

    • params: {
          inputAsset: Asset;
          outputAsset?: Asset;
          params: DeletePagesParams;
      }

      The parameters for constructing an instance of DeletePagesJob.

      • inputAsset: Asset

        The input asset for the job. Cannot be undefined.

      • Optional outputAsset?: Asset

        Asset object representing the output asset.

      • params: DeletePagesParams

        DeletePagesParams object containing the page ranges to be deleted. Cannot be undefined.

    Returns DeletePagesJob

    Remarks

    External assets can be set as output only when input is external asset as well.

Properties

_deletePagesParams: DeletePagesParams
_inputAsset: Asset
_outputAsset?: Asset

Methods

  • Parameters

    Returns PDFServicesApiRequest

  • Returns PageActionCommand[]

  • Parameters

    • executionContext: ExecutionContext

    Returns void

Generated using TypeDoc