WPCubed Product Support

Tips and tricks for merging large documents

We're running across some issues with appending a large number of documents together. We are getting an Out of Memory error from windows -- which varies depending on the machine. What we are noticing is that there is no disk caching happening before the error is thrown. This might be the normal behavior of TMemoryStream -- not sure, haven't looked into it that far yet.

We're looking for any advice you have for managing large documents -- over 500 pages. What sorts of issues do you run into at that size of document?

We did find [](http://www.wpcubed.com/forum/viewtopic.php?t=648). We're getting the same Out of Memory error message as in [](http://www.wpcubed.com/forum/viewtopic.php?t=2800).

Our solution is using a TWPPreview component which is updated by a TWPCustomRichText (we used this approach because of the component hierarchy). After every "append as section" call on the customRTF object, the TWPPreview panel is updated with an

preview.AsString := customRTF.AsString;

We have run some tests where the merge program runs out of memory at 118,000K and sometimes at 159,000K (on a 2GB memory machine). Our customers have the potential of printing 1000+ page documents. Do you have any other components that would make this job easier? Manage memory better?

I see the problem as one where the model of concatenating all of the merged documents together does not scale well -- given memory limitations. I know some other reporting tools only merge one "record" at a time and just let the document spool to the printer and let the spooler do the work. Any insight here?

#1 ♥ 0
3k Views 2 links 2 users read 3 min
support

Hi,

I know some other reporting tools only merge one "record" at a time and just let the document spool to the printer and let the spooler do the work. Any insight here?<<

WPTools can do this easiy, but you do not have a preview of the complete document here.

To do so simply call BeginPrint / EndPrint and print each document inbetween. You can even print from a different TWPRichText, will still go into same printer cue.

For preview you can do it as outlines, store each sub document in a data base blob (you can use a self made indexed file as well) and load it into a TWPRichText for preview. (A TWPRichText is a perfect preview, it can do everything the TWPPreview, does, too - same class)

Julian

#2 ♥ 0
This category is archived. No new posts are possible.