Image size too big

You might encounter the following error message:

Couldn’t load image: image size too big

This means the image size exceeds the allocated memory limit in the SDK.

Solution

You can override the default image memory ratio by modifying the dimen.xml file in your Android project.

Steps to override pspdf__max_image_memory_ratio

  1. Open your res/values/dimen.xml file. If the file doesn’t exist, create it.

  2. Add the following XML entry to override the image memory ratio:

<resources xmlns:tools="http://schemas.android.com/tools">
    <item tools:override="true" name="pspdf__max_image_memory_ratio" format="float" type="dimen">0.35</item>
</resources>
  1. Adjust the 0.35 value to a suitable ratio depending on your app’s memory constraints.

  2. Rebuild and restart the application to apply the changes.

Notes

  • Increasing pspdf__max_image_memory_ratio allows larger images to load but may impact app performance.

  • Ensure the device has enough memory to handle the increased image size.

  • If issues persist, consider optimizing images before loading them in the app.