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(
                         System.getenv("PDF_SERVICES_CLIENT_ID"),
                         System.getenv("PDF_SERVICES_CLIENT_SECRET"));
    
                 PDFServices pdfServices = new PDFServices(credentials);
    
                 Asset asset = pdfServices.upload(inputStream, PDFServicesMediaType.PDF.getMediaType());
    
                 PageRanges pagesToReorder = new PageRanges();
                 pageRanges.addRange(3, 4);
                 pageRanges.addSinglePage(1);
    
                 ReorderPagesParams reorderPagesParams = ReorderPagesParams
                         .reorderPagesParamsBuilder(asset, pagesToReorder)
                         .build();
    
                 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.
        Parameters:
        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
        Parameters:
        asset - Asset object representing the output asset; can not be null.
        Returns:
        ReorderPagesPDFJob instance