# The Conversion Class - Google App Engine - Google Code

English ▼
Skip to page content Skip to main navigation
e.g. "templates" or "datastore"

# The Conversion Class

#### Experimental!

Conversion is an experimental, innovative, and rapidly changing new feature for App Engine. Unfortunately, being on the bleeding edge means that we may make backwards-incompatible changes to Conversion. We will inform the community when this feature is no longer experimental.

Class `Conversion` represents a conversion from one file format to another.

A conversion request must contain at least one asset, typically the document contents. Additional assets are those needed for the conversion (such as images in HTML).

`Conversion` is defined in the module `google.appengine.api.conversion`.

- Constructor
- Instance method:
  - add_asset

## Constructor

The constructor for class `Conversion` is defined as follows:

Conversion(asset, output_mime_type, image_width=800, first_page=1, last_page=None, ocr_input_language=None)

Construct an instance of class `Conversion`.

  Arguments

    asset
      Asset (class `Asset`) to add to conversion request.
    output_mime_type
      String denoting MIME type for output data.
    image_width
      Output image width, in pixels. Applies only to conversions that generate image files.
    first_page
      Number of first page to generate. Applies only to conversions that generate image files.
    last_page
      Number of last page to generate. Applies only to conversions that generate image files.
    ocr_input_language/span>
      Language code in BCP 47 format, used by the optical character recognition (OCR) engine to search for a language-specific character set.

  Result value

    A new instance of class `Conversion`.

  Exceptions

    TypeError
      A parameter has an invalid type, or an unknown attribute was passed.
    ValueError
      A parameter has an invalid value.

## Instance Method

Instances of class `Conversion` have the following method:

add_asset(self, asset)

Add asset to conversion request.

  Argument

    asset
      Asset (class `Asset`) to add.

  Exception

    TypeError
      Parameter has invalid type.