exportImagesToPdf method

Exports images to PDF format. An array of images can be exported, see options description for details.

export async function exportImagesToPdf(settings)

Parameters

settings
Object specifying parameters of the image export to PDF (see Options).

Return values

The method returns result depending on how the scenario finished (see Result).

Options

The table below describes parameters that you can pass as the settings argument to change image export to PDF settings. Omitting a parameter means that a default setting will be used.

Parameter Value type Description
licenseFileName string

The name of the license file. This file must be located in the /assets/ directory in your project.

Default: "MobileCapture.License".

images object[]

Array of images for export with corresponding information. Each image can have the following parameters:

  • pageSize (object): image size represented by its width and height in points  (1/72 of an inch). I.e., a page size of A4 is 595x842.
    If both width and height are set to 0, image size will be detected in pixels.
    The values of the width and height are stored in corresponding width and height parameters:
    • width (int)
    • height (int)
  • compressionLevel (string): the uniform image compression scale for lossy formats. Valid for export to JPG only. This parameter can be set to the following values:
    • 'Low'
    • 'Normal'
    • 'High'
    • 'ExtraHigh'
    Default: 'Low'.
  • imageUri (string): Image source for the operation passed as URI. This parameter can be set to the following values:
    • "Base64": you can pass an encode base64 image string, i.e. "data:image/jpeg;base64,<base64 encoded image data>"
    • "File": image file address, i.e. "file:///data/user/0/com.abbyy.rtr.reactnative.sample.coreapi/files/pages/page_848b121d-5a7a-4ead-94e6-dd91bc6bfead.jpg".
      'content://' schema is also supported for Android.
    Required parameter.
result object

Result PDF file description, represented by the following parameters:

  • destination (string): result image will be saved to corresponding file ("File") or returned as encode base64 image string ("Base64"). Default: "Base64".
  • filePath (string): full path to the exported file. This parameter is used only if the destination is 'File'. Otherwise the value will be ignored. In case the destination is 'File' and this parameter is not set, the path will be generated automatically.
pdfInfo object

Extra information corresponding to the PDF file. This object can have the following parameters:

  • title (string)
  • subject (string)
  • keywords (string)
  • author (string)
  • company (string)
  • creator (string)
  • producer (string)

Result

This section describes the object that represents image capture results. Returned parameters depend on the scenario.

Parameter Value type Description
pdfUri string Result URI, corresponding to the description in the passed result parameter. If the PDF file destination was 'File', this parameter value corresponds to the filePath parameter value with 'file://' prefix.

Example of a result JSON.

3/2/2022 12:59:15 PM

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.