Free Support Forum - aspose.com

Aspose PDF merging issue


#1

We are facing the out of memory issue while trying to merge the PDF
for large files. We tried to resolve the issue by using the below
method in our java code which is using Aspose for merging but we
didn’t see any benefit and issue is still persisting. Please suggest
how we can resolve it.
com.aspose.pdf.MemoryCleaner.clear();


#2

@raviciti

Thanks for contacting support.

Would you please make sure to use latest version of the API i.e. Aspose.PDF for Java 19.1 as latest version includes more performance improvements. Furthermore, in order to process large PDF documents, you need to allocate high system memory by increasing -xms and -xmx values.

In case you still face any issue, please upload your document to Dropbox OR Google Drive and share the link with us along with sample code snippet. We will test the scenario in our environment and address it accordingly.


#3

Hi Asad,

Thanks for your response.
We recently upgraded to 18.7 for our prod. So it is very long process to move to new version as multiple approval and planning would require.

Here we are attatching Aspose test program results log and Jconsole memory files for your reference. Could you please provide any work around for memory cleanup with the same version (18.7).

Regards
Ravi Agrawal
aspose.zip (212.9 KB)


#4

@raviciti

Thanks for sharing details.

We have observed the details shared by you. However, as requested earlier, would you please share some sample PDF document along with sample code snippet. We will test the scenario in our environment and address it accordingly. Also, please share your environment details i.e. OS name and version, JDK version, Application Type, etc.


#5

Aspose.zip (1.9 MB)
Hi Team ,

We are sorry for delay in response cause aspose account was put on hold.
PFA sample code and document that we are using.

server details - window server 2008 R2 / service pack 1/ 64 bit
Java details - 1.8.0.91

Regards
Ravi Agrawal


#6

@raviciti

The archive you shared contains only one PDF document i.e. test3.pdf. We have tried to merge it with one of our sample document and were unable to replicate the issue that you mentioned. Would you please share your second PDF file as well which reference is included in the code snippet shared by you. We will again test the scenario in our environment and share our feedback accordingly.


#7

Hi Team,

I tried to upload large size PDF but unfortunetrly its getting fail.
Please try to process some large file to replicate the issue.

Regards
Ravi Agrawal


#8

@raviciti

In case of larger files, you may please upload it to Dropbox or Google Drive and share the link with us.


#9

Hi Team,

We dont have access for dropbox or google drive so as requested earlier also kindly test this with any of your PDF file having size more then 1 GB.


#10

@raviciti

We are testing the scenario and will get back to you shortly.


#11

@raviciti

We have tested the scenario using two documents (both having size more than 1.3GB). We were still unable to reproduce the exception that you are facing. Please note that sometimes issue may be related with specific PDF document due to its complexity and structure. It is requested if you can please share some more details like complete exception with Stack Trace and sample code snippet. We will further proceed to help you accordingly.


#12

Hi Team,

Total size more than 1 GB means after merging of two file its size should be more than 1 GB .
Such scenerios are getting fail during aspose merging in our process.
So please test such scenerion instead of processing the file having size more than 1 gb .


#13

@raviciti

We have tested both scenarios (i.e. two files generating more than 1GB file after merge and two files with each more than 1GB generating ~2.5GB file after merge) and were unable to replicate the exception. That was why we requested you to share complete exception message along with stack trace which you are observing at your side. Also, please try running similar scenario with latest version of the API and share your feedback with us.


#14

AsposeMerge.zip (1.4 KB)

Hi Team,

Aspose clear statement is not freeing up any memory after using clear statement as you can seeen in belog log statements and also attaching sample program as provided earlier also.

Input file Name1:C:\temp\asposetest\input\test7.pdf size(MB):1

Input file Name2:C:\temp\asposetest\input\inputtest7.pdf size(MB):1

output file Name:C:\temp\asposetest\output\mergedDoc7.pdf

Before merge ::

:: Memory Status : Used memory(MB):387, Free memory(MB):165, Total memory(MB):553, Max memory(MB):910

After merge ::

:: Memory Status : Used memory(MB):228, Free memory(MB):328, Total memory(MB):557, Max memory(MB):910

After free up memory of all docs::

:: Memory Status : Used memory(MB):228, Free memory(MB):328, Total memory(MB):557, Max memory(MB):910

Successfully merged file:C:\temp\asposetest\output\mergedDoc7.pdf size(MB):1

================================================================================

Input file Name1:C:\temp\asposetest\input\test8.pdf size(MB):3

Input file Name2:C:\temp\asposetest\input\inputtest8.pdf size(MB):3

output file Name:C:\temp\asposetest\output\mergedDoc8.pdf

Before merge ::

:: Memory Status : Used memory(MB):261, Free memory(MB):295, Total memory(MB):557, Max memory(MB):910

After merge ::

:: Memory Status : Used memory(MB):305, Free memory(MB):253, Total memory(MB):559, Max memory(MB):910

After free up memory of all docs::

:: Memory Status : Used memory(MB):305, Free memory(MB):253, Total memory(MB):559, Max memory(MB):910

Successfully merged file:C:\temp\asposetest\output\mergedDoc8.pdf size(MB):5

================================================================================

Input file Name1:C:\temp\asposetest\input\test9.pdf size(MB):1

Input file Name2:C:\temp\asposetest\input\inputtest9.pdf size(MB):1

output file Name:C:\temp\asposetest\output\mergedDoc9.pdf

Before merge ::

:: Memory Status : Used memory(MB):324, Free memory(MB):234, Total memory(MB):559, Max memory(MB):910

After merge ::

:: Memory Status : Used memory(MB):366, Free memory(MB):192, Total memory(MB):559, Max memory(MB):910

After free up memory of all docs::

:: Memory Status : Used memory(MB):366, Free memory(MB):192, Total memory(MB):559, Max memory(MB):910

Successfully merged file:C:\temp\asposetest\output\mergedDoc9.pdf size(MB):3


#15

@raviciti

Thanks for sharing these details.

We have created an investigation ticket in our issue tracking system as PDFJAVA-38432. We will further investigate the scenario and as soon as we have some definite updates regarding investigation completion, we will let you know. Please be patient and spare us little time.

We are sorry for the inconvenience.