Class RotatePagesJob


  • public class RotatePagesJob
    extends PDFServicesJob
    A job that allows rotation of specific pages in a PDF file.

    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 firstPageRange = new PageRanges();
                 firstPageRange.addSinglePage(1);
                 RotatePagesParams rotatePagesParams = RotatePagesParams.rotatePagesParamsBuilder()
                         .withAngleToRotatePagesBy(Angle._90, firstPageRange)
                         .build();
                 RotatePagesJob rotatePagesJob = new RotatePagesJob(asset, rotatePagesParams);
    
                 String location = pdfServices.submit(rotatePagesJob);
                 PDFServicesResponse<RotatePagesResult> pdfServicesResponse = pdfServices.getJobResult(location, RotatePagesResult.class);
    
                 Asset resultAsset = pdfServicesResponse.getResult().getAsset();
                 StreamAsset streamAsset = pdfServices.getContent(resultAsset);
     
    • Constructor Detail

      • RotatePagesJob

        public RotatePagesJob​(Asset asset,
                              RotatePagesParams rotatePagesParams)
        Constructs a new RotatePagesJob instance.
        Parameters:
        asset - Asset object containing the input file; can not be null.
        rotatePagesParams - RotatePagesParams object containing the rotation angle and page ranges; can not be null.
    • Method Detail

      • setOutput

        public RotatePagesJob 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:
        RotatePagesJob instance