I am trying to combine lots of PDF documents into a single PDF document using the PXCp_InsertPagesTo() method.
Everything is working fine, as long as I keep the overall number of pages and file size under a certain threshold. The exact threshold is yet to be determined, but I was able to successfully generate a 7,000 pages/65 MB document. However, I failed creating a 22,000 pages document. A PDF file does get created, but it is corrupted, and Acrobat is unable to open it.
The appending of the pages and the optimization steps always succeed, even on a 40,000 pages file, but the save step fails with the following error:
- PXCp_Err_FormatSeverity() returns "Error",
- PXCp_Err_FormatFacility() returns "Operating system",
- PXCp_Err_FormatErrorCode() returns "error -2081161208".
I have not been able to find any information about this error code, and am not sure how to address it. Any help would be welcome!
The code is written in .Net 4.0 and has been running on a Windows 7 Professional - 64 bit OS, with a Q9650 processor at 3GHz and 4GB of RAM.
The input files for the test were generated by the PDF XChange printer driver.
Here is a pseudo-code summary of the operation
PXCp_Init(destination)
Loop for each source document:
PXCp_Init(source)
PXCp_ReadDocumentW(source)
PXCp_InsertPagesTo(source, destination)
PXCp_Delete(source)
end loop
PXCp_OptimizeFonts(destination)
PXCp_OptimizeStreamCompression(destination)
PXCp_WriteDocumentW(destination) <-- this is where the error occurs.
PXCp_Delete(destination)
Thank you for your assistance!
-2081161208 error code when saving big file
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
-
- User
- Posts: 4
- Joined: Fri Nov 18, 2011 8:21 pm
-
- Site Admin
- Posts: 6903
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
Re: -2081161208 error code when saving big file
HI oliverkx,
your question is going to need one of our developers. They are finished for the week. It may be Monday now before you get an answer from them. I've made a note here to see that someone does take a look however.
hth
your question is going to need one of our developers. They are finished for the week. It may be Monday now before you get an answer from them. I've made a note here to see that someone does take a look however.
hth
Best regards
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
-
- User
- Posts: 4
- Joined: Fri Nov 18, 2011 8:21 pm
Re: -2081161208 error code when saving big file
Much appreciated, thank you!
-
- Site Admin
- Posts: 6903
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
Re: -2081161208 error code when saving big file
Best regards
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
-
- Site Admin
- Posts: 677
- Joined: Thu Jun 28, 2007 8:42 am
Re: -2081161208 error code when saving big file
It looks like you have problems with system resources: error -2081161208 was returned from the system and means "Not enough storage is available to process this command".
There may be several issues with merging alot of files into one:
1. xcpro was not designed for such heavy load and therefore it keeps all touched objects in memory until the document is closed. When you insert pages from one document into another you have two copies until you close the source, and one copy until you close the destination document. This can use a lot of memory if you have many of pages. A work-around is to modify your code to handle not all files at once, but using some reasonable portions
2. When you insert alot of pages you may also use a lot of temporary files, which remain open utill you release document. Typically Windows limits the number of handles used by an application, so problems may arise here too. The work-around is the same as above.
I don't know which files you are using and how much memory is required to keep their data, so you need to fine tune that element regarding size yourself to suit the typical circumstances you might expect in your experience.
Also, it may be a good idea to use 64-bit binaries on a 64-bit OS (since 32-bit binaries limit memory usage to less than 2GB regardless how much memory is available). However this will not remove the handles limit, so a work around from p.1 must be used.
HTH.
There may be several issues with merging alot of files into one:
1. xcpro was not designed for such heavy load and therefore it keeps all touched objects in memory until the document is closed. When you insert pages from one document into another you have two copies until you close the source, and one copy until you close the destination document. This can use a lot of memory if you have many of pages. A work-around is to modify your code to handle not all files at once, but using some reasonable portions
Code: Select all
loop while (we have files to merge)
open destination document
append 1000 files (or less, depending on typical pages count in appended files, better do not exceed 1000-5000 pages limit per portion)
save destination document
release it
end loop
I don't know which files you are using and how much memory is required to keep their data, so you need to fine tune that element regarding size yourself to suit the typical circumstances you might expect in your experience.
Also, it may be a good idea to use 64-bit binaries on a 64-bit OS (since 32-bit binaries limit memory usage to less than 2GB regardless how much memory is available). However this will not remove the handles limit, so a work around from p.1 must be used.
HTH.
Victor
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 4
- Joined: Fri Nov 18, 2011 8:21 pm
Re: -2081161208 error code when saving big file
Hi, thank you for your reply!
I ran some more tests keeping my code unchanged. Increasing the computer memory from 4GB to 8GB did not change anything, but going from the 32bit SDK to the 64bit SDK allowed me to compile a PDF file with over 22,000 pages.
Next, I will try your suggested technique and see if this helps me push the page count even further (our objective is to get past 50,000 pages).
A question regarding the 64bit version of the SDK: I tried copying all the 64-bit SDK DLL's into my executable directory. I also removed all the 32bit DLLs from my system. But the xcpro40 DLL would refuse to load until I copied all the DLLs to the Windows\System32 folder instead.
Do you have any information on this issue?
Thanks again for your help!
Best regards,
Oliver.
I ran some more tests keeping my code unchanged. Increasing the computer memory from 4GB to 8GB did not change anything, but going from the 32bit SDK to the 64bit SDK allowed me to compile a PDF file with over 22,000 pages.
Next, I will try your suggested technique and see if this helps me push the page count even further (our objective is to get past 50,000 pages).
A question regarding the 64bit version of the SDK: I tried copying all the 64-bit SDK DLL's into my executable directory. I also removed all the 32bit DLLs from my system. But the xcpro40 DLL would refuse to load until I copied all the DLLs to the Windows\System32 folder instead.
Do you have any information on this issue?
Thanks again for your help!
Best regards,
Oliver.
-
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
Re: -2081161208 error code when saving big file
This suggests that there is another copy of the xcpro40.dll in another folder that is being referenced prior to the one in your exectubale directory - possibly due to the defined system variables or some other reference.
Try searching your system for other versions of this dll and and rename sufficiently that they will be ignored - or delete if you feel they are otherwise not needed.
HTH
Try searching your system for other versions of this dll and and rename sufficiently that they will be ignored - or delete if you feel they are otherwise not needed.
HTH
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 4
- Joined: Fri Nov 18, 2011 8:21 pm
Re: -2081161208 error code when saving big file
Will do, thanks!
I also applied your algorithm and was able to build a 52,000 pages document this way. Awesome!
I also applied your algorithm and was able to build a 52,000 pages document this way. Awesome!
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: -2081161208 error code when saving big file
Great to hear you got successfully a 52 000 page file!
And do let us know how the search for other instances of our dlls goes!
Best,
Stefan
And do let us know how the search for other instances of our dlls goes!
Best,
Stefan