Add Image in XPS Document using Aspose.Page - memory consumption issues

How to use the aspose api to control and manage this memory when processing business? I found that when using the idea tool to add watermarks to XPS files, the amount of memory used will reach 10GB. My personal computer is 64GB. If our application design (Java development) uses 4GB, then processing XPS (larger than 100 pages) of large files will easily cause memory overflow problems.

@wanyangye,

Thanks for contacting support.

Can you please share source files along with sample project so that we may further investigate to help you out. Also please share complete environment details with us.

Sorry, that file is too big (maximum size is 50000kb). Why not upload your large file to a cloud sharing service, then paste the link?

@wanyangye

You can surely upload file to some file sharer and share the link with us.

I have sent the link to Adnan.Ahmad as a short message, please help to see it.

@wanyangye,

Thank you for contacting support.

We have reproduced and logged the error as PAGEJAVA-84 in our issue management system for further investigations and resolution. We will let you know once any update will be available in this regard.

PAGEJAVA-84】Is there any new progress on this issue?

@wanyangye,

I like to inform that issue has been added recently in our issue tracking system and we request for your patience. We will share good news with you soon.

It’s almost half a month. Is there any new development?

@wanyangye

The ticket was logged 8 days ago under the model of free support where issues have low priority and are resolved on first come first serve basis. Due to other issues in the queue, we are afraid that this ticket is still pending for analysis. We will surely let you know as soon as we make some certain progress in its investigation. Please give us some time.

We are sorry for the inconvenience.

Whether this bug is resolved.

@wanyangye

We are afraid that your issue is not yet resolved. We have recorded your concerns and will definitely consider them during issue investigation. We will let you know in case we have some additional updates. Please spare us some time.

We are sorry for the inconvenience.

Whether to resolve.

@wanyangye

We would like to share that your issue has been resolved and its fix will be available in Aspose.Page for Java 20.1 which will be released in this month. We will surely notify you as soon as fix is available.

@wanyangye

We would like to inform you that mentioned issue has been resolved and its fix is available in Aspose.Page for Java 20.1. Please download latest version and let us know in case you face any issue.

The issues you have found earlier (filed as PAGEJAVA-84) have been fixed in Aspose.Page for Java 20.1.

19d3111d-aabe-4710-90f7-b4dc3cc8be84.zip (1.4 MB)

Processing this file will report an error。

Specified argument was out of the range of valid values.
Parameter name: Offset out of range. 3901719016
com.aspose.page.internal.l184.I2l.lif(Unknown Source)
com.aspose.xps.I61.lI(Unknown Source)
com.aspose.xps.I61.llf(Unknown Source)
com.aspose.xps.I61.lif(Unknown Source)
com.aspose.xps.I9I.lif(Unknown Source)
com.aspose.xps.I9I.lif(Unknown Source)
com.aspose.xps.I9l.lif(Unknown Source)
com.aspose.xps.I9l.lif(Unknown Source)
com.aspose.xps.I10l.lif(Unknown Source)
com.aspose.xps.I10l.lif(Unknown Source)
com.aspose.xps.XpsPath.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.XpsCanvas.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.XpsPage.lif(Unknown Source)
com.aspose.xps.I1l.lif(Unknown Source)
com.aspose.xps.I4I.lIf(Unknown Source)
com.aspose.xps.XpsDocument.ll(Unknown Source)
com.aspose.xps.XpsDocument.lif(Unknown Source)
com.aspose.xps.XpsDocument$I7.lif(Unknown Source)
com.aspose.page.internal.l424.Il.lif(Unknown Source)
com.aspose.page.internal.l424.II.lif(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.insolu.ImageWaterMark.test(ImageWaterMark.java:25)
com.insolu.OcrDemo.main(OcrDemo.java:13)
Exception in thread “main” class com.aspose.page.internal.l16I.I01: Specified argument was out of the range of valid values.
Parameter name: Offset out of range. 3901719016
com.aspose.page.internal.l184.I2l.lif(Unknown Source)
com.aspose.xps.I61.lI(Unknown Source)
com.aspose.xps.I61.llf(Unknown Source)
com.aspose.xps.I61.lif(Unknown Source)
com.aspose.xps.I9I.lif(Unknown Source)
com.aspose.xps.I9I.lif(Unknown Source)
com.aspose.xps.I9l.lif(Unknown Source)
com.aspose.xps.I9l.lif(Unknown Source)
com.aspose.xps.I10l.lif(Unknown Source)
com.aspose.xps.I10l.lif(Unknown Source)
com.aspose.xps.XpsPath.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.XpsCanvas.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.XpsPage.lif(Unknown Source)
com.aspose.xps.I1l.lif(Unknown Source)
com.aspose.xps.I4I.lIf(Unknown Source)
com.aspose.xps.XpsDocument.ll(Unknown Source)
com.aspose.xps.XpsDocument.lif(Unknown Source)
com.aspose.xps.XpsDocument$I7.lif(Unknown Source)
com.aspose.page.internal.l424.Il.lif(Unknown Source)
com.aspose.page.internal.l424.II.lif(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.insolu.ImageWaterMark.test(ImageWaterMark.java:25)
com.insolu.OcrDemo.main(OcrDemo.java:13)
at com.aspose.page.internal.l184.I2l.lif(Unknown Source)
at com.aspose.xps.I61.lI(Unknown Source)
at com.aspose.xps.I61.llf(Unknown Source)
at com.aspose.xps.I61.lif(Unknown Source)
at com.aspose.xps.I9I.lif(Unknown Source)
at com.aspose.xps.I9I.lif(Unknown Source)
at com.aspose.xps.I9l.lif(Unknown Source)
at com.aspose.xps.I9l.lif(Unknown Source)
at com.aspose.xps.I10l.lif(Unknown Source)
at com.aspose.xps.I10l.lif(Unknown Source)
at com.aspose.xps.XpsPath.lif(Unknown Source)
at com.aspose.xps.XpsElement.lif(Unknown Source)
at com.aspose.xps.XpsCanvas.lif(Unknown Source)
at com.aspose.xps.XpsElement.lif(Unknown Source)
at com.aspose.xps.XpsPage.lif(Unknown Source)
at com.aspose.xps.I1l.lif(Unknown Source)
at com.aspose.xps.I4I.lIf(Unknown Source)
at com.aspose.xps.XpsDocument.ll(Unknown Source)
at com.aspose.xps.XpsDocument.lif(Unknown Source)
at com.aspose.xps.XpsDocument$I7.lif(Unknown Source)
at com.aspose.page.internal.l424.Il.lif(Unknown Source)
at com.aspose.page.internal.l424.II.lif(Unknown Source)
at com.aspose.xps.XpsDocument.save(Unknown Source)
at com.aspose.xps.XpsDocument.save(Unknown Source)
at com.insolu.ImageWaterMark.test(ImageWaterMark.java:25)
at com.insolu.OcrDemo.main(OcrDemo.java:13)

@wanyangye

We have managed to observe the issue while adding image inside your XPS document using Aspose.Page for Java 20.1. We have logged this issue as PAGEJAVA-87 in our issue tracking system for the sake of correction. We will further look into this and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.

I encountered the same problem again, the file is attached.

@wanyangye

There are 3 files over the link you shared. Are you facing issue with all files?