Package com.adobe.pdfservices.operation
Class PDFServices
- java.lang.Object
-
- com.adobe.pdfservices.operation.PDFServices
-
public class PDFServices extends Object
This class is the entry point for all the PDF Service utilities. These utilities can be used to perform various functions such as submittingPDFServicesJob
, getting status of aPDFServicesJob
, getting result of aPDFServicesJob
, uploadingAsset
, getting content of anAsset
, deleting anAsset
and refreshing anAsset
.Methods provided by the utility are:
- Upload
Asset(s)
- Submit
PDFServicesJob
- Get status of a
PDFServicesJob
- Get result of a
PDFServicesJob
- Get content of
Asset
- Delete
Asset
- Refresh
Asset
- Upload
-
-
Constructor Summary
Constructors Constructor Description PDFServices(Credentials credentials)
Constructs aPDFServices
instance with the givenCredentials
.PDFServices(Credentials credentials, ClientConfig clientConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteAsset(Asset asset)
Deletes asset from PDF Services storage.StreamAsset
getContent(Asset asset)
Returns the content of the asset.<T> PDFServicesResponse<T>
getJobResult(String pollingURL, Class<T> resultClass)
ReturnsPDFServicesResponse
for the submittedPDFServicesJob
result.PDFServicesJobStatusResponse
getJobStatus(String pollingURL)
ReturnsPDFServicesJobStatusResponse
for the submittedPDFServicesJob
.Asset
refreshDownloadURI(Asset asset)
Returns a newAsset
with a new valid download URI.String
submit(PDFServicesJob pdfServicesJob)
Creates thePDFServicesJob
and returns the polling URL.String
submit(PDFServicesJob pdfServicesJob, List<NotifierConfig> notifyConfigList)
Creates thePDFServicesJob
with the givenNotifierConfig
and returns the polling URL.Asset
upload(InputStream inputStream, String mimeType)
Upload content from input stream and returns anAsset
to be used in PDF Services SDK.List<Asset>
uploadAssets(List<StreamAsset> uploadAssetList)
Upload content from list ofStreamAsset
and returns a list ofAsset
to be used in PDF Services SDK.
-
-
-
Constructor Detail
-
PDFServices
public PDFServices(Credentials credentials)
Constructs aPDFServices
instance with the givenCredentials
.- Parameters:
credentials
- Credentials to be used for authentication; can not be null.
-
PDFServices
public PDFServices(Credentials credentials, ClientConfig clientConfig)
- Parameters:
credentials
- Credentials to be used for authentication; can not be null.clientConfig
- Client configuration forPDFServices
; can not be null.
-
-
Method Detail
-
submit
public String submit(PDFServicesJob pdfServicesJob) throws ServiceApiException
Creates thePDFServicesJob
and returns the polling URL.- Parameters:
pdfServicesJob
-PDFServicesJob
to be submitted; can not be null.- Returns:
- Polling URL that can be used to get the status and result of the job
- Throws:
ServiceApiException
- If an error is encountered while submitting the job.SDKException
- is thrown for client-side or network errors.ServiceUsageException
- if service usage limits have been reached or credentials quota has been exhausted.
-
submit
public String submit(PDFServicesJob pdfServicesJob, List<NotifierConfig> notifyConfigList) throws ServiceApiException
Creates thePDFServicesJob
with the givenNotifierConfig
and returns the polling URL.- Parameters:
pdfServicesJob
-PDFServicesJob
to be submitted; can not be null.notifyConfigList
- List ofNotifierConfig
to be used for notification; can not be null.- Returns:
- Polling URL that can be used to get the status and result of the job
- Throws:
ServiceApiException
- If an error is encountered while submitting the job.SDKException
- is thrown for client-side or network errors.ServiceUsageException
- if service usage limits have been reached or credentials quota has been exhausted.
-
getJobResult
public <T> PDFServicesResponse<T> getJobResult(String pollingURL, Class<T> resultClass) throws ServiceApiException
ReturnsPDFServicesResponse
for the submittedPDFServicesJob
result.- Parameters:
pollingURL
- URL to be polled to get the job result; can not be null or empty.resultClass
- result class forPDFServicesJob
, it will be an implements ofPDFServicesJobResult
; can not be null.- Returns:
PDFServicesResponse
with the job result- Throws:
ServiceApiException
- If an error is encountered while getting the job result.SDKException
- is thrown for client-side or network errors.
-
getJobStatus
public PDFServicesJobStatusResponse getJobStatus(String pollingURL) throws ServiceApiException
ReturnsPDFServicesJobStatusResponse
for the submittedPDFServicesJob
.- Parameters:
pollingURL
- URL to be polled to get the job status; can not be null or empty.- Returns:
PDFServicesJobStatusResponse
encapsulating the job status and retry interval- Throws:
ServiceApiException
- If an error is encountered while getting the job status.
-
upload
public Asset upload(InputStream inputStream, String mimeType) throws ServiceApiException
Upload content from input stream and returns anAsset
to be used in PDF Services SDK.Method will not close the input stream, responsibility of closing the input stream lies with the client.
- Parameters:
inputStream
- input stream that is to be uploaded; can not be null.mimeType
- mime type of the input stream; can not be null or empty.- Returns:
Asset
asset containing the uploaded content- Throws:
ServiceApiException
- If an error is encountered while uploading the asset.SDKException
- is thrown for client-side or network errors.ServiceUsageException
- if service usage limits have been reached or credentials quota has been exhausted.
-
uploadAssets
public List<Asset> uploadAssets(List<StreamAsset> uploadAssetList) throws ServiceApiException
Upload content from list ofStreamAsset
and returns a list ofAsset
to be used in PDF Services SDK.Method will not close the input stream of the Stream Asset, responsibility of closing the input stream lies with the client.
- Parameters:
uploadAssetList
-StreamAsset
list that is to be uploaded; can not be null.- Returns:
Asset
list containing the assets with uploaded content- Throws:
ServiceApiException
- If an error is encountered while uploading the assets.SDKException
- is thrown for client-side or network errors.ServiceUsageException
- if service usage limits have been reached or credentials quota has been exhausted.
-
getContent
public StreamAsset getContent(Asset asset) throws ServiceApiException
Returns the content of the asset.- Parameters:
asset
-Asset
asset to the content; can not be null.- Returns:
StreamAsset
stream asset containing the stream content along with the media type- Throws:
ServiceApiException
- If an error is encountered while getting the content.SDKException
- is thrown for client-side or network errors.
-
deleteAsset
public void deleteAsset(Asset asset) throws ServiceApiException
Deletes asset from PDF Services storage.- Parameters:
asset
-Asset
asset to be deleted; can not be null.- Throws:
ServiceApiException
- If an error is encountered while deleting the asset.SDKException
- is thrown for client-side or network errors.
-
refreshDownloadURI
public Asset refreshDownloadURI(Asset asset) throws ServiceApiException
Returns a newAsset
with a new valid download URI.- Parameters:
asset
-Asset
asset to be refreshed; can not be null.- Returns:
Asset
asset with a new valid download URI- Throws:
ServiceApiException
- If an error is encountered while refreshing the asset.SDKException
- is thrown for client-side or network errors.
-
-