目录

ArkTS API Error Codes

This section describes only module-specific error codes. For details about universal error codes, please refer to Universal Error Codes.

1011301001 Array Size Mismatch

Message

The arrays of pageIndices and matrices do not match.

Description

The lengths of the pageIndices and matrices arrays are different.

Possible causes

The lengths of the pageIndices and matrices arrays are different.

Solution

Ensure that the length of the pageIndices array is the same as that of the matrices array.

1011301002 Page Number Out of Range

Message

Invalid page number.

Description

The page number in pageIndices is not within the valid range.

Possible causes

  1. The page number is less than 0.
  2. The page number is greater than or equal to the total number of PDF pages.
  3. The total number of pages specified by pageIndices exceeds 16.

Solution

Ensure that the page number specified by pageIndices is greater than or equal to 0 and less than the total number of pages, and the total number of pages does not exceed 16.

1011301003 Maximum Pixel Limit Exceeded

Message

The number of pixels in the bitmap exceeds the upper limit.

Description

The number of pixels in the bitmap exceeds the upper limit.

Possible causes

The number of pixels corresponding to the bitmap size (bitmapWidth × bitmapHeight) exceeds 250 MB.

Solution

Ensure that the number of pixels corresponding to the bitmap size (bitmapWidth × bitmapHeight) does not exceed 250 MB.

1011301004 Failed to Create a Bitmap

Message

Failed to create a bitmap.

Description

Failed to create a bitmap.

Possible causes

System resources are insufficient.

Solution

  1. Reduce the number of pages to be rendered. Render a single page or a few pages instead of rendering multiple pages.
  2. Close unused PDF document instances and clear the image cache.
  3. Try to reduce the value of bitmapWidth or bitmapHeight to reduce the memory usage.

1011301005 Failed to Render the Bitmap

Message

Failed to render the bitmap.

Description

Failed to render the bitmap.

Possible causes

The PDF document is incomplete.

Solution

  1. Use a PDF reader to open the file and check whether the file can be properly displayed.
  2. Compare the size of the original file with that of the transferred or copied file to ensure that they are the same.

1011301006 PDF Document Not Loaded

Message

The PDF document is not loaded.

Description

The PDF document is not loaded and cannot be accessed.

Possible causes

The document has not been loaded through the initialization process or the loading process is interrupted.

Solution

Call loadDocument to trigger the loading process again.

1011302001 Incorrect Page Number

Message

Invalid page number.

Description

The value of initPageIndex passed to loadDocumentFromMemory is not within the valid range.

Possible causes

  1. The page number is less than 0.
  2. The page number is Infinity.
  3. The page number is NaN.

Solution

Ensure that the value of initPageIndex is a natural number.

1011302002 Loaded Document Not Released

Message

The loaded document has not been freed.

Description

A loaded document is not released.

Possible causes

After the loadDocumentFromMemory API is called to successfully load the binary data stream of a document, the releaseDocument API is not called to release the document. Instead, the binary data stream of the document is loaded again in the same controller.

Solution

Call the releaseDocument API to release the binary data stream of the document loaded by the current controller.

1011302003 Empty or Out-of-Range Binary Stream Loaded

Message

The input ArrayBuffer is empty or exceeds the maximum limit.

Description

The binary data stream loaded by the loadDocumentFromMemory API is empty or exceeds the maximum size supported by the API.

Possible causes

  1. The currently loaded binary data stream is empty.
  2. The size of the currently loaded binary data stream exceeds the maximum size of 1 GB.

Solution

  1. Ensure that the input binary data stream contains content.
  2. Check the size of the input binary data stream and ensure that the size does not exceed 1 GB.

1011302004 Rendering Busy

Message

The rendering thread is busy.

Description

Rendering is busy.

Possible causes

The interval between the current call and the last call of this API is less than 300 ms.

Solution

Wait for 300 ms before calling this API again.

1011302005 Invalid Rendering Mode

Message

Unknown rendering mode.

Description

The rendering mode is invalid.

Possible causes

The value passed to setRenderMode is out of the specified range.

Solution

Reset the parameter constraints to allow only predefined enumerated values.

1011302006 Loading Busy

Message

Another document is being loaded.

Description

The current document cannot be loaded because there is an unfinished asynchronous loading task.

Possible causes

The asynchronous loading API is concurrently called within a short period of time.

Solution

Check the calling logic to avoid consecutive calls of the asynchronous loading API.