Print Page | Close Window

Problems work with large files

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3042
Printed Date: 28 Apr 24 at 8:04PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problems work with large files
Posted By: Nick
Subject: Problems work with large files
Date Posted: 29 Dec 14 at 4:08PM
Every day I work with a lot of large files.
I have a problem.

QP.LoadFromFile ('big_18000pages.pdf', '');
QP.DeletePages (1,1);
QP.SaveToFile ('big_18000pages.pdf '); //'Out of memory'.

If there is a solution to this problem, the topic will be closed.

Thanks!



Replies:
Posted By: tfrost
Date Posted: 29 Dec 14 at 6:28PM
I do not have a file with 18000 pages to test, but if the problem is really a memory issue, you could try building with the 64-bit compiler and then adding as much RAM and paged memory as your application needs to manipulate the file in memory.  How big is your file?  What does Task Manager or Process Explorer report for your available memory?  What compiler version are you using?  What have you done already to quantify and investigate the issue?

Alternatively you could use the DA functions and simply hide the first page.  You probably will hardly notice the file size difference between that and deleting it.  If your real application involves more than just removing the one page, tell us what the real problem is, rather than just the example of the first failure.

Oh, and asking the same question twice will not get an answer quicker, especially during an extended holiday period.  And topics here remain available permanently, they are not closed, so that other users can benefit.



Posted By: Nick
Date Posted: 30 Dec 14 at 3:49PM
Dear tfrost!
Thank you very much for your attention on the eve of the New Year.
Delphi 7, Win 7, 6.00 GB, 64-bit.
My idea:
...
QP.AddToFileList('FilesToMerge', '01.pdf'); // File with source pushbutton.
QP.AddToFileList('FilesToMerge', '02.pdf'); // Here to insert pushbutton.
QP.MergeFileListFast('FilesToMerge', 'tmp.pdf');
QP.LoadFromFile('tmp.pdf', '');
Btn := QP.FindFormFieldByTitle('Button1');
QP.SetFormFieldPage(Btn,2);
QP.DeletePages(1,1);
QP.SaveToFile('02.pdf'); // If a large file, the message "Not enough memory".
DeleteFile('tmp.pdf');
...

Really works quickly and without any problems with small files.
Inserts button in 100 files for 5-6 seconds.

Happy New Year!


Posted By: tfrost
Date Posted: 30 Dec 14 at 5:32PM
You are obviously out of luck with Delphi 7 to use all your 6GB of memory by compiling as 64-bit.  You need to monitor the available memory in your application to see how much you are short.  A standard 32-bit app will only access 2GB.  If you think that adding another GB will make the app work, you can add (in the DPR):

  {$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}

If that symbol is not defined in Windows.pas in D7, you can substitute its value, which is 32.  This will give your app up to 3GB either on a 64-bit OS, or on a 32-bit OS which has been configured (in BOOT.INI) to be 3GB aware.  Google LARGE_ADDRESS_AWARE if you are not familiar with all this.  However this is not worth trying if your calculations and estimates tell you that 3GB will also be insufficient.  Use Process Explorer or Task Manager at a breakpoint to see how much memory is used in your app with various PDF sizes which are below the failure size, then extrapolate to estimate how much a larger PDF will need.

Good luck and Happy New Year to you also!



Posted By: Chopinke
Date Posted: 27 Jan 15 at 10:28AM
Why don't you check out QP.DAxxxx functions, they are supposed to handle large files optimized...



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk