Class ReorderPagesPDFJob

  • public class ReorderPagesPDFJob
    extends PDFServicesJob
    A job that allows to rearrange pages in a PDF file according to the specified order.

    Sample Usage:

                 InputStream inputStream = new FileInputStream(new File("SOURCE_PATH"));
                 Credentials credentials = new ServicePrincipalCredentials(
                 PDFServices pdfServices = new PDFServices(credentials);
                 Asset asset = pdfServices.upload(inputStream, PDFServicesMediaType.PDF.getMediaType());
                 PageRanges pagesToReorder = new PageRanges();
                 pageRanges.addRange(3, 4);
                 ReorderPagesParams reorderPagesParams = ReorderPagesParams
                         .reorderPagesParamsBuilder(asset, pagesToReorder)
                 ReorderPagesPDFJob reorderPagesPDFJob = new ReorderPagesPDFJob(reorderPagesParams);
                 String location = pdfServices.submit(reorderPagesPDFJob);
                 PDFServicesResponse<ReorderPagesResult> pdfServicesResponse = pdfServices.getJobResult(location, ReorderPagesResult.class);
                 Asset resultAsset = pdfServicesResponse.getResult().getAsset();
                 StreamAsset streamAsset = pdfServices.getContent(resultAsset);
    • Constructor Detail

      • ReorderPagesPDFJob

        public ReorderPagesPDFJob​(ReorderPagesParams reorderPagesParams)
        Constructs a new ReorderPagesPDFJob instance.
        reorderPagesParams - ReorderPagesParams object containing the input file and the page numbers in the order to be rearranged; can not be null.
    • Method Detail

      • setOutput

        public ReorderPagesPDFJob setOutput​(Asset asset)
        Sets the output asset for the job. @note External assets can be set as output only when input is external asset as well
        asset - Asset object representing the output asset; can not be null.
        ReorderPagesPDFJob instance