public class CreatePDFOperation extends Object implements Operation
setOptions(CreatePDFOptions) method.
 
 The supported source media types are listed here. The CreatePDFOperation.SupportedSourceFormat enum can be used to map file
 extensions to their corresponding media types when creating FileRef instances for the source files.
 
Sample Usage:
   CreatePDFOperation createPdfOperation = CreatePDFOperation.createNew();
   createPdfOperation.setInput(FileRef.createFromLocalFile("~/Documents/createPdfInput.docx",
                                                           CreatePDFOperation.SupportedSourceFormat.DOCX.getMediaType()));
   Credentials credentials = Credentials.serviceAccountCredentialsBuilder().fromFile("pdftools-api-credentials.json").build();
   FileRef result = createPdfOperation.execute(ExecutionContext.create(credentials));
   result.saveAs("output/CreatePDFOutput.pdf");
 
 Special handling for HTML inputs:
An HTML input can only be provided as a local zip archive. When creating the corresponding FileRef instance, the media type must be "application/zip" for the local zip archive. Zip archive must have the following structure:
Sample layout:
html_files.zip |__index.html |__referenced_file_1.css |__referenced_file_2.jpeg |__subfolder_1 |_____referenced_file_3.jpeg
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
CreatePDFOperation.SupportedSourceFormat
Supported source file formats for  
CreatePDFOperation. | 
| Modifier and Type | Method and Description | 
|---|---|
static CreatePDFOperation | 
createNew()
Constructs a  
CreatePDFOperation 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 | 
setOptions(CreatePDFOptions createPdfOptions)
Sets the conversion parameters for this operation. 
 | 
public static CreatePDFOperation createNew()
CreatePDFOperation instance.CreatePDFOperation instancepublic void setInput(FileRef sourceFileRef)
sourceFileRef - an input filepublic void setOptions(CreatePDFOptions createPdfOptions)
CreatePDFOptions for how to specify the
 conversion parameters for the different source media types.createPdfOptions - conversion parameters; use null for default valuespublic 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 exhausted.Copyright © 2020 Adobe. All rights reserved.