Class CombinePDFJob


  • public class CombinePDFJob
    extends PDFServicesJob
    A job that combines multiple PDF files into a single PDF file. Allows specifying which pages of the source files to combine.

    Sample Usage:

    
                 InputStream inputStream1 = new FileInputStream(new File("SOURCE_PATH"));
                 InputStream inputStream2 = 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 asset1 = pdfServices.upload(inputStream1, PDFServicesMediaType.PDF.getMediaType());
                 Asset asset2 = pdfServices.upload(inputStream2, PDFServicesMediaType.PDF.getMediaType());
    
                 CombinePDFParams combinePDFParams = CombinePDFParams.combinePDFParamsBuilder()
                         .addAsset(asset1)
                         .addAsset(asset2)
                         .build();
                 CombinePDFJob combinePDFJob = new CombinePDFJob(combinePDFParams);
    
                 String location = pdfServices.submit(combinePDFJob);
                 PDFServicesResponse<CombinePDFResult> pdfServicesResponse = pdfServices.getJobResult(location, CombinePDFResult.class);
    
                 Asset resultAsset = pdfServicesResponse.getResult().getAsset();
                 StreamAsset streamAsset = pdfServices.getContent(resultAsset);
    
     
    • Constructor Detail

      • CombinePDFJob

        public CombinePDFJob​(CombinePDFParams combinePDFParams)
        Constructs a new CombinePDFJob instance.
        Parameters:
        combinePDFParams - CombinePDFParams object containing the input files and the page ranges to be combined; can not be null.
    • Method Detail

      • setOutput

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