public class DeletePagesOperation extends Object implements Operation
Sample Usage:
   DeletePagesOperation deletePagesOperation = DeletePagesOperation.createNew();
   deletePagesOperation.setInput(FileRef.createFromLocalFile("~/Documents/deletePagesOperationInput.pdf",
                                                             DeletePagesOperation.SupportedSourceFormat.PDF.getMediaType()));
   PageRanges pageRanges = new PageRanges();
   pageRanges.addSinglePage(1);
   deletePagesOperation.setPageRanges(pageRanges);
   Credentials credentials = Credentials.serviceAccountCredentialsBuilder().fromFile("pdftools-api-credentials.json").build();
   FileRef result = deletePagesOperation.execute(ExecutionContext.create(credentials));
   result.saveAs("output/deletePagesOperationOutput.pdf");
 | Modifier and Type | Class and Description | 
|---|---|
static class  | 
DeletePagesOperation.SupportedSourceFormat
Supported source file formats for  
DeletePagesOperation. | 
| Modifier and Type | Method and Description | 
|---|---|
static DeletePagesOperation | 
createNew()
Constructs a  
DeletePagesOperation 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 | 
setInput(FileRef sourceFileRef)
Sets an input file. 
 | 
void | 
setPageRanges(PageRanges pageRanges)
Specifies the pages to delete from the input PDF file 
 | 
public static DeletePagesOperation createNew()
DeletePagesOperation instance.DeletePagesOperation instancepublic void setInput(FileRef sourceFileRef)
sourceFileRef - an input file; can not be nullpublic void setPageRanges(PageRanges pageRanges)
pageRanges - page ranges for deletion; can not be null or emptypublic 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.