API Reference

Contents:

PDFServices

class adobe.pdfservices.operation.pdf_services.PDFServices(credentials: Credentials, *, client_config: ClientConfig | None = None)

Bases: object

This class is the entry point for all the PDF Service utilities. These utilities can be used to perform various functions such as submitting PDFServicesJob, getting status of a PDFServicesJob, getting result of a PDFServicesJob, uploading Asset, getting content of an Asset, deleting an Asset and refreshing an Asset.

Constructs a new PDFServices instance with the given Credentials and ClientConfig.

Parameters:
  • credentials (Credentials) – Credentials to be used for authentication; can not be None.

  • client_config (ClientConfig) – Client configuration for PDFServices. (Optional, use key-value)

delete_asset(asset: Asset)

Deletes asset from PDF Services storage.

Parameters:

asset (Asset) – Asset to be deleted; can not be None.

Raises:
  • ServiceApiException – If an error is encountered while submitting the job.

  • SdkException – Is thrown for client-side or network errors.

get_content(asset: Asset) StreamAsset
Parameters:

asset (Asset) – Asset to the content; can not be None.

Raises:
  • ServiceApiException – If an error is encountered while submitting the job.

  • SdkException – Is thrown for client-side or network errors.

Returns:

Returns the content of the asset.

Return type:

StreamAsset

get_job_result(polling_url: str, result_type: ABCMeta) PDFServicesResponse

Returns PDFServicesResponse for the submitted PDFServicesJob result.

Parameters:
  • polling_url (str) – URL to be polled to get the job result; can not be None.

  • result_type (PDFServicesJobResult.__class__) – result class for PDFServicesJob, it will be an implementation of PDFServicesJobResult; can not be None.

Raises:
  • ServiceApiException – If an error is encountered while submitting the job.

  • SdkException – Is thrown for client-side or network errors.

Returns:

PDFServicesResponse for the submitted job.

Return type:

PDFServicesResponse

get_job_status(polling_url: str) PDFServicesJobStatusResponse
Parameters:

polling_url (str) – URL to be polled to get the job status; can not be None.

Raises:
  • 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.

Returns:

Returns PDFServicesJobStatusResponse for the submitted PDFServicesJob.

Return type:

PDFServicesJobStatusResponse

refresh_download_uri(asset: Asset) Asset
Parameters:

asset (Asset) – asset to be refreshed; can not be None.

Raises:
  • ServiceApiException – If an error is encountered while submitting the job.

  • SdkException – Is thrown for client-side or network errors.

Returns:

a new Asset with a new valid download URI.

Return type:

Asset

submit(pdf_services_job: PDFServicesJob, *, notify_config_list: List | None = None) str

Creates the PDFServicesJob and returns the polling URL.

Parameters:
  • pdf_services_job (PDFServicesJob) – PDFServicesJob} to be submitted; can not be None.

  • notify_config_list (list) – List of NotifierConfig to be used for notification. (Optional, use key-value)

Raises:
  • 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.

Returns:

the polling URL.

Return type:

str

upload(input_stream: Any, mime_type: str) Asset

Upload content from input stream and returns an Asset 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:
  • input_stream – input stream that is to be uploaded; can not be None.

  • mime_type (str) – mime type of the input stream; can not be None.

Raises:
  • 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.

Returns:

asset containing the uploaded content

Return type:

Asset

upload_assets(upload_asset_list: List) []

Upload content from list of StreamAsset and returns a list of Asset 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:

upload_asset_list (list) – StreamAsset list that is to be uploaded; can not be None.

Raises:
  • ServiceApiException – If an error is encountered while submitting the job.

  • SdkException – Is thrown for client-side or network errors.

Returns:

returns a list of Asset to be used in PDF Services SDK.

Return type:

list

PDFServicesJob

class adobe.pdfservices.operation.pdf_services_job.PDFServicesJob

Bases: ABC

This abstract class represents the basic contract for all the PDF Services Jobs. It imposes no restrictions or particular details on the job execution process and leaves the specifics of setting up the jobs to their individual implementations.

PDFServicesJobStatus

class adobe.pdfservices.operation.pdf_services_job_status.PDFServicesJobStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Status types for PDFServicesJob.

Constructs PDF Services job status using its string representation.

Parameters:

value (str) – string representation of PDF services job status.

DONE = 'done'

Represents completed status

FAILED = 'failed'

Represents failed status

IN_PROGRESS = 'in progress'

Represents in progress status

get_value()
Returns:

string representation of PDFServicesJobStatus.

Return type:

str

PDFServicesJobStatusResponse

class adobe.pdfservices.operation.pdf_services_job_status_response.PDFServicesJobStatusResponse(status: str, headers: {})

Bases: object

Response object encapsulating PDFServicesJob status and retry interval.

Constructs PDFServicesJob status response with its status, headers.

Parameters:
  • status (str) – Status of the PDFServicesJob.

  • headers (dict) – Headers of the PDFServicesResponse.

get_retry_interval() int
Returns:

retry interval for status polling of the PDFServicesJob in seconds.

Return type:

int

get_status()
Returns:

string representation of PDFServicesJobStatus for the PDFServicesJob.

Return type:

str

PDFServicesMediaType

class adobe.pdfservices.operation.pdf_services_media_type.PDFServicesMediaType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, Enum

AI = 'application/illustrator'

Represents ai mime type.

BMP = 'image/bmp'

Represents bmp mime type.

CSV = 'text/csv'

Represents csv mime type.

DOC = 'application/msword'

Represents msword mime type.

DOCX = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'

Represents docx mime type.

GIF = 'image/gif'

Represents gif mime type.

HTML = 'text/html'

Represents html mime type.

INDD = 'application/x-indesign'

Represents indd mime type.

JPEG = 'image/jpeg'

Represents jpeg mime type.

JPG = 'image/jpeg'

Represents jpg mime type.

JSON = 'application/json'

Represents json mime type.

PDF = 'application/pdf'

Represents pdf mime type.

PNG = 'image/png'

Represents png mime type.

PPT = 'application/vnd.ms-powerpoint'

Represents ppt mime type.

PPTX = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'

Represents pptx mime type.

PSD = 'image/vnd.adobe.photoshop'

Represents psd mime type.

RTF = 'text/rtf'

Represents rtf mime type.

SVG = 'image/svg+xml'

Represents svg mime type.

TIF = 'image/tiff'

Represents tif mime type.

TIFF = 'image/tiff'

Represents tiff mime type.

TXT = 'text/plain'

Represents txt mime type.

XLS = 'application/vnd.ms-excel'

Represents xls mime type.

XLSX = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'

Represents xlsx mime type.

ZIP = 'application/zip'

Represents zip mime type.

property extension
Returns:

Extension of PDFServicesMediaType.

static get_from_extension(extension: str)
Returns:

PDFServicesMediaType for the given extension.

property mime_type
Returns:

Media type of PDFServicesMediaType.

PDFServicesResponse

class adobe.pdfservices.operation.pdf_services_response.PDFServicesResponse(status: str, headers: {<class 'str'>: <class 'str'>}, result)

Bases: PDFServicesJobStatusResponse

Response object for PDFServicesJob.

Constructs PDFServicesJob response with its status, headers and result.

Parameters:
get_result()
Returns:

Returns instance of result of PDFServicesJob.

Region

class adobe.pdfservices.operation.region.Region(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, Enum

Supported regions to be used with ClientConfig.

EU = 'eu'

Represents “Europe” region

US = 'us'

Represents “US” region