Image size too big
You might encounter the following error message:
Couldn’t load image: image size too bigThis 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
Open your
res/values/dimen.xmlfile. If the file doesn’t exist, create it.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>Adjust the
0.35value to a suitable ratio depending on your app’s memory constraints.Rebuild and restart the application to apply the changes.
Notes
- Increasing
pspdf__max_image_memory_ratioallows 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.