Page 1 of 1

PrintPreview - TMetafileList storage file size limit (2GB)

PostPosted: January 14th, 2019, 10:00 am
by mitzix
Hi,
I found problem when there's a lot of pages to print. When TMetafileList.Storage temp file exceeds 2GB boundary it is not possible to display or print pages retrieved from this file (not cached). It is due to bad variable types in Delphi Vcl.Graphics.TMetafile methods (e.g. TestEMF) where Size variable is declared as Longint instead of Int64. It can be overriden with class hack but there's bigger problem. It seems that TEnhMetaHeader declared in Windows cannot be used with big files (>2GB) due to its member offDescription declared as DWORD. This type is used in whole TMetafile class. This issue affects all Delphi versions up to Rio.
Only solution I see is to split TMetafileList storage file to multiple parts less than 2GB or save each page in separate file. Can you please fix this issue?

Re: PrintPreview - TMetafileList storage file size limit (2G

PostPosted: February 6th, 2019, 8:31 pm
by VPC16
Or have an error flag that the memory has been reached to exit gracefully. Looking at this but this option is not obvious, may need a new Method.

Re: PrintPreview - TMetafileList storage file size limit (2G

PostPosted: February 10th, 2019, 10:48 am
by Kambiz
Hi,

Having a 2GB of preview content is too much.
Would it be better to render only pages that the user view?

Re: PrintPreview - TMetafileList storage file size limit (2G

PostPosted: March 19th, 2021, 11:37 am
by mrtossas
Hi,
Mitzix,could you find a solution? I have the problem that I generate a document of 750 pages, which are displayed correctly, but when sending them to the printer it gives metafile error ... The temporary file during the preview does not exceed 2GB, but when sending it to the printer it keeps increasing and when it exceeds 2GB it gives an error ... I don't understand it. I don't understand why it gets bigger when I send it to the printer. Thanks for any help ...