Page 1 of 1

Cannot combine large pdfs

Posted: Thu Nov 24, 2022 8:45 am
by prasantha
Hi everyone,
I tried to combine around 400 files into a single file which willbe around 1.8 Gb in size after combine. I used the below code to combhine them
image.png
But some time it raise below exception, sometime it works well.
image(1).png
Can anybody let me know how to get rid of these errors.

It has much more free space available in memory, and I have set the /LARGEADDRESSAWARE flag onthe exe as well

Re: Cannot combine large pdfs

Posted: Thu Nov 24, 2022 9:01 am
by zarkogajic
Hi,

32bit app ?

What does "IAUX_Inst::FormatHRESULT" say about that exception?

Look for memory usage in Task Manager (working set, peak, ...) - if it goes over 3GB ... bad luck...

-žarko

Re: Cannot combine large pdfs

Posted: Thu Nov 24, 2022 10:56 am
by prasantha
Hi žarko,
Yes it is 32 bit app.

The error comes as soon as the memory usage goes over 1.4 GB (from task manager) fort he application , The workstation uses 6GB out of 8 GB when error occurs.
I cant track the exception further, because SDK itself shows error message and handle from sdk itself

Re: Cannot combine large pdfs

Posted: Thu Nov 24, 2022 12:53 pm
by zarkogajic
Hi,

32bit app on x86 or x64 Windows?

try/catch wrap the call to AsyncDoAndWait... and check for exception and then FormatHResult.



-žarko

Re: Cannot combine large pdfs

Posted: Thu Nov 24, 2022 1:30 pm
by Lzcat - Tracker Supp
Hi, prasantha

For the first, SDK was not intended to handle unlimited count of files at once. Opening each file require some memory and system resources, and because each process in Windows have serious limitation opening too many files at once was always a bad idea. Moreover, you are using 32-bit application, so you have very serious memory and address space limitations. Combining documents require that files must be opened and data from them must be transferred into other one, and during transferring we have two copies of data in memory - in original document and in resulting. So, in your case most optimal solution is not combining all files at once, but split work into smaller chunks. However, I'm not sure that 32-bit limitations will allow you to make final merge - expected 1.8 GB on disk may require much more than 3Gb memory to merge documents correctly. So I strongly recommend using 64-bit application instead of 32-bit one. If this is not possible for some reason your last chance will be using Insert pages instead of combine documents, inserting pages from each file at once and immediately closing source documents to reduce memory usage. But there is no guaranty that 32-bit code can handle such file correctly even in this case.

Kind regards,
Lzcat - Tracker Supp

Re: Cannot combine large pdfs

Posted: Thu Nov 24, 2022 9:42 pm
by zarkogajic
Hi Prasantha

Are you using the latest version of SDK?

I'm using code similar to what you have to combine way more than 400 files (some PDF, some Word, some Excel - so conversion also takes place during the process), size per single file is not more than 100MB.
32bit (IMAGE_FILE_LARGE_ADDRESS_AWARE) app on x64.
The total size of the saved combined file is 3.8 GB and it has ~73K pages !
Memory "Peek Working Set" never goes above 1.2 GB.

p.s.
Not using C# though.

@Victor: never mind if you've heard before: your SDK is awesome!

-žarko

Re: Cannot combine large pdfs

Posted: Fri Nov 25, 2022 12:48 pm
by Tracker Supp-Stefan
zarkogajic wrote: Thu Nov 24, 2022 9:42 pm @Victor: never mind if you've heard before: your SDK is awesome!
:D :D :D