adobe.pdfservices.operation.io package

Submodules

adobe.pdfservices.operation.io.file_ref module

class adobe.pdfservices.operation.io.file_ref.FileRef

Bases: ABC

This class represents a local file. It is typically used by an SDK Operation which accepts or returns files.

When a FileRef instance is created by this SDK while referring to a temporary file location, calling any of the methods to save the fileRef (For example, create_from_stream() etc.) will delete the temporary file.

static create_from_local_file(local_source: str, media_type: str | None = None)

Creates a FileRef instance from a local file path. If no media type is provided, it will be inferred from the file extension.

Parameters:
  • local_source (str) – Local file path, either absolute path or relative to the working directory.

  • media_type (str, optional, defaults to None) – Media type to identify the local file format, defaults to None

Returns:

A FileRef instance.

Return type:

FileRef

static create_from_stream(input_stream: BufferedReader, media_type: str)

Creates a FileRef instance from a readable stream using the specified media type. The stream is not read by this method but by consumers of file content i.e. the execute method of an operation such as execute().

Parameters:
  • input_stream (BufferedReader) – Readable Stream representing the file.

  • media_type (str) – Media type to identify the file format.

Returns:

A FileRef instance.

Return type:

FileRef

get_media_type()

returns the media type

abstract save_as(local_file_path: str)
abstract write_to_stream(writer_stream)

Module contents