public class InsertPagesOperation extends Object implements Operation
 For more complex use cases, refer the CombineFilesOperation.
 
Sample Usage:
   InsertPagesOperation insertPagesOperation = InsertPagesOperation.createNew();
   insertPagesOperation.setBaseInput(FileRef.createFromLocalFile("~/Documents/insertPagesOperationBaseInput.pdf",
                                                             InsertPagesOperation.SupportedSourceFormat.PDF.getMediaType()));
   insertPagesOperation.addPagesToInsertAt(FileRef.createFromLocalFile("~/Documents/insertPagesOperationFileToInsertInput.pdf",
                                                             InsertPagesOperation.SupportedSourceFormat.PDF.getMediaType()), 1);
   Credentials credentials = Credentials.serviceAccountCredentialsBuilder().fromFile("pdftools-api-credentials.json").build();
   FileRef result = insertPagesOperation.execute(ExecutionContext.create(credentials));
   result.saveAs("output/insertPagesOperationOutput.pdf");
 | Modifier and Type | Class and Description | 
|---|---|
static class  | 
InsertPagesOperation.SupportedSourceFormat
Supported source file formats for  
InsertPagesOperation. | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addPagesToInsertAt(FileRef inputFile,
                  int basePage)
Adds all the pages of the input PDF file to be inserted at the specified page of the base PDF file. 
 | 
void | 
addPagesToInsertAt(FileRef inputFile,
                  PageRanges pageRanges,
                  int basePage)
Adds the specified pages of the input PDF file to be inserted at the specified page of the base PDF file 
 | 
static InsertPagesOperation | 
createNew()
Constructs a  
InsertPagesOperation instance. | 
FileRef | 
execute(ExecutionContext context)
Executes this operation synchronously using the supplied context and returns a new FileRef instance for the resulting PDF file. 
 | 
void | 
setBaseInput(FileRef sourceFileRef)
Sets the base input file. 
 | 
public static InsertPagesOperation createNew()
InsertPagesOperation instance.InsertPagesOperation instancepublic void setBaseInput(FileRef sourceFileRef)
sourceFileRef - the base input file; can not be nullpublic void addPagesToInsertAt(FileRef inputFile, int basePage)
This method can be invoked multiple times with the same or different input PDF files.
inputFile - a PDF file for insertion; can not be nullbasePage - page of the base PDF filepublic void addPagesToInsertAt(FileRef inputFile, PageRanges pageRanges, int basePage)
This method can be invoked multiple times with the same or different input PDF files.
inputFile - a PDF file for insertion; can not be nullpageRanges - page ranges of the input PDF file; can not be null or emptybasePage - page of the base PDF filepublic FileRef execute(ExecutionContext context) throws ServiceApiException, IOException, ServiceUsageException
 The resulting file may be stored in the system temporary directory (per java.io.tmpdir System property).
 See FileRef for how temporary resources are cleaned up.
execute in interface Operationcontext - the context in which to execute the operationServiceApiException - if an API call results in an error responseIOException - if there is an error in reading either the input source or the resulting PDF fileServiceUsageException - if service usage limits have been reached or credentials quota has been exhaustedCopyright © 2020 Adobe. All rights reserved.