Page 1 of 1

Out of memory exception when using TPrintPreview

PostPosted: June 22nd, 2004, 3:29 pm
by kra
Hello All,

First of all, thank you to the author and all contributors!
I have searched around a lot and TPrintPreview seems to be what
I have looked around!

Unfortunately when loading bigger graphics (two times 500x6500 pixels)
into the preview I get an 'out of memory' exception
(Triggered by the closing of the metafile)

I have already set UseTempFile to true(as I understand this is necessary with many pages, or in my case with few(one) page with very big bitmaps in it)

Any suggestions what I can do?

Christian

PostPosted: June 22nd, 2004, 8:14 pm
by Kambiz
I modified the demo program (Genaral) by loading a 2000x6500x24bit bitmap (37MB) in to Image2 (an invisible control), which its content appears on the second page of the preview. As you can guess, there was no out of memory exception. My machine has XP with 512MB memory.

I guess your OS is either Windows 98 or NT 4.

I suggest to downsample the images.

PostPosted: June 23rd, 2004, 7:28 am
by kra
Hello,

Thank you for the lightspeed response!
Now I have some good hints where to search.

Yes, my laptop still runs W98. Unfortunately customers use W98/NT4/W2K
/XP so I would like to support all that platforms.

Do I understand it correctly that there is a problem with the maximal size
of memory streams for the metafile? Would it be possible to use a disk based file instead?

The application has to do with marking of boxes. There are big (background) bitmaps containing mostly whitespace, but some drawing
objects like barcodes, logos etc. For reason of WYSIWYG downsampling would be suboptimal, as thin lines and fine parts of the logos might
disappear.

Best regards,

Christian

PostPosted: June 23rd, 2004, 9:14 am
by Kambiz
Hi,

The problem is not in Metafile. Windows cannot manage huge bitmaps.

You should divide the original bitmap to some smaller ones, and then tile the background with them.

Cheers,
Kambiz