Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

EOutOfResources when sending by email or exporting to PDF

edited April 2013 in General
I have a report with several ppRichEdits (Infopower enabled) and some of
my customers are having problems when they try to send the report by
email (using the button in the default preview dialog) or save the
report to PDF:

EOutOfResources
Espaço insuficiente de armazenamento para processar este comando.

In english, it would be something like: Not enough space to proccess the
command.

The problem doesnt happens on my machine, so it is difficult to debug.

I'm using ppReport1.PDFSettings.ExportRTFAsBitmap:=true since I have
several richedits in the report and depending on the content, they are
not being exported correctly.

Any guess? Solution?

Call stack:

main thread ($d24):
0055faa3 +077 app.exe Vcl.Graphics GDIError
0055fadb +007 app.exe Vcl.Graphics GDICheck
0056420b +117 app.exe Vcl.Graphics CopyBitmap
00564bef +063 app.exe Vcl.Graphics TBitmap.CopyImage
00566bdf +04b app.exe Vcl.Graphics TBitmap.SetSize
00566453 +00b app.exe Vcl.Graphics TBitmap.SetHeight
00aae035 +041 app.exe ppPDFRendererImage
TppPDFRendererImage.ConvertMetaFile
00aade22 +096 app.exe ppPDFRendererImage
TppPDFRendererImage.GetGraphicAsBitmap
00aad9f8 +12c app.exe ppPDFRendererImage
TppPDFRendererImage.CreateImage
00aae541 +08d app.exe ppPDFRendererImage
TppPDFRendererImage.RenderToPDF
00ab1860 +1b0 app.exe ppPDFRendererGeneric
TppPDFRendererGeneric.RenderToPDF
00ab2d9e +086 app.exe ppPDFDevice TppPDFDevice.DrawToPage
00ab2be7 +14b app.exe ppPDFDevice
TppPDFDevice.SavePageToFile
00a2bc80 +048 app.exe ppFilDev
TppFileDevice.ReceivePage
00ab2a94 +000 app.exe ppPDFDevice TppPDFDevice.ReceivePage
00a05050 +0b4 app.exe ppDevice
TppPublisher.TakeDeviceAction
00a05388 +018 app.exe ppDevice TppPublisher.ReceivePage
00b6369e +016 app.exe ppReport TppReport.PageSent
00b9b1bd +015 app.exe ppClass
TppCustomEngine.DoOnPageSent
00b5bf26 +1b6 app.exe ppEngine TppEngine.SendPage
00b5b928 +184 app.exe ppEngine TppEngine.FinishPage
00b5ad81 +18d app.exe ppEngine TppEngine.GenerateBands
00b5a73f +20b app.exe ppEngine TppEngine.GeneratePage
00b5a897 +0e3 app.exe ppEngine TppEngine.RestorePage
00b5a3c1 +049 app.exe ppEngine TppEngine.Generate
00b5a2e0 +10c app.exe ppEngine TppEngine.RequestPage
00b63574 +0e0 app.exe ppReport TppReport.RequestPage
00a054f9 +055 app.exe ppDevice
TppPublisher.DoOnPageRequest
00a05297 +063 app.exe ppDevice TppPublisher.Publish
00b18b1e +006 app.exe ppProd
TppProducer.PublishReport
00b18bf7 +07f app.exe ppProd
TppProducer.PrintToDevices
00b6345a +07e app.exe ppReport TppReport.PrintToDevices
00b19270 +4bc app.exe ppProd
TppProducer.PrintToPrinter
00b18a94 +054 app.exe ppProd
TppProducer.PrintWithSameParameters
00ad3c9b +227 app.exe ppEmail TppEmail.ProcessAndSend
00ad385d +0e1 app.exe ppEmail TppEmail.Send
00b19a9f +02f app.exe ppProd TppProducer.SendMail
00a567b4 +00c app.exe ppPreview
TppCustomPreview.SendEmail
00a565ac +088 app.exe ppPreview
TppCustomPreview.PerformPreviewAction
00a58cb8 +044 app.exe ppPreview
TppPreview.ehToolbutton_Click
00977b83 +0ab app.exe ppTB2Item TppTBCustomItem.Click
00977a5f +0b3 app.exe ppTB2Item
TppTBCustomItem.ClickWndProc
00525740 +014 app.exe System.Classes StdWndProc
7e368a0b +00a USER32.dll
DispatchMessageW
00672d87 +0f3 app.exe Vcl.Forms
TApplication.ProcessMessage
00672dca +00a app.exe Vcl.Forms
TApplication.HandleMessage
0066e7e1 +1a1 app.exe Vcl.Forms TCustomForm.ShowModal
009fa33f +01f app.exe ppForms TppForm.ShowModal
00b18d51 +089 app.exe ppProd
TppProducer.PrintToScreen
00b18a0f +05f app.exe ppProd TppProducer.Print
00b625b6 +01e app.exe ppReport TppReport.Print

Comments

  • edited April 2013
    Hi Carlos,

    For RB 14, we improved the quality of the bitmaps exported when using
    the ExportRTFAsBitmap and ExportMetaFileAsBitmap features. This however
    can take up more memory if the metafiles/Richtexts are large.

    Use the MetafileToBitmapQuality property to adjust how large the bitmaps
    are before they are exported to PDF. The default is 5, try reducing to
    3 or 2 and see if that helps.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2013
    I found that changing the video driver configuration to use 16bits
    instead of 32bits is a workaround for the problem.

    I noticed that the quality of the images in the PDF is much worse in IBO
    14 than in IBO 10. If I set MetafileToBitmapQuality to 3 it gets even
    worse, but it solves the problem even with 32bits colors, but customers
    rejected the solution due to the bad quality of the result.

    Is there any other thing I can do to keep a reasonable quality and make
    it work with 32bits colors drivers? Is there a way to use the old method
    of RB 10?

    Carlos

    Em 19/04/2013 11:50, Nico Cizik (Digital Metaphors) escreveu:
  • edited April 2013
    If you set the MetafileToBitmapQuality to 1 you will get the exact same
    quality you got in RB 10.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2013
    Also set UseJPEGCompression to False. RB 10 did not support JPEG images
    in PDF.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2013
    Em 19/04/2013 13:44, Nico Cizik (Digital Metaphors) escreveu:

    This seems to not be true. I generated the same report with RB 10 and RB
    14, and the quality is perfect in RB 10 (and it doesnt cause any
    OutOfResources problem) and much worse with RB 14. I'm sending both PDFs
    samples to your support email, so you can compare yourself.

    PS: Setting DisableJPGCompression didn't help to enhance the quality,
    nor setting MetafileToBitmapQuality.

    My customers are pressing me a lot, and I dont know what more to do.
    Please take a look at the PDFs I have sent, and get back to me. I'm
    ready to test any patch you would like to provide.

    Waiting for your contact.

    Carlos
  • edited April 2013
    We are not able to tell much from simply looking at the PDF source.
    Please send a simple example that I can test with RB 10 and RB 14 (I
    have both installed) to us in .zip format and I'll take a look at it for
    you.

    Do you by chance have PDFSettings.ScaleImages set to True for RB 14?

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2013
    I thought setting the MetafileToBitmapQuality to a low number (or
    decreasing the color depth of the video to 16bits) would solve the
    problem for all of my customers and be used like a temporary solution,
    but this proved to not be true. Some of them are still getting the error.

    I was able to simulate the problem in my development machine, but I had
    to increase MetafileToBitmapQuality to 6 to make it happen here. I could
    trace to the following line:

    aBitmap.Width := lGraphic.Width * PDFSettings.MetafileToBitmapQuality;
    aBitmap.Height := lGraphic.Height * PDFSettings.MetafileToBitmapQuality;
    aBitmap.Palette := lGraphic.Palette;
    aBitmap.HandleType := bmDIB;<--------- Out of Resources!!!
    aBitmap.Canvas.StretchDraw(Rect(0, 0, aBitmap.Width, aBitmap.Height),
    lGraphic);

    This problem is driving me crazy, and I had to revert to RB 10 until DM
    can provide me with a fix that works fine and with the same generated
    quality as RB 10 produced the PDFs.

    Carlos


    Em 19/04/2013 13:44, Nico Cizik (Digital Metaphors) escreveu:
  • edited April 2013
    I just sent a sample app to your support email. Follow the instructions
    described in the email and let me know.

    ScaleImages is true, since it is the default setting. Setting it to
    false makes the PDF much bigger, and takes 10x more time to be saved. It
    also doesnt solve the problem with the OutOfResources.

    Carlos

    Em 22/04/2013 11:40, Nico Cizik (Digital Metaphors) escreveu:
  • edited April 2013
    For future reference please use your full name when posting.

    In my testing with your example, setting ScaleImages to False with
    MetafileToBitmapQuality set to 1 gave a comparable output to the same
    PDF generated with RB 10.

    You are correct in that RB 10 handles Richtext a bit differently than RB
    11 +. For RB 10, the RichText component was drawn directly to a bitmap
    canvas using the drawcommand and a temporary screen device. For RB 11
    and later, the Richtext is drawn as a metafile then either directly
    drawn to the PDF or first converted to a bitmap then drawn to PDF. It
    is this conversion process that is causing the difference in output.

    We will consider re-adding the older method of exporting Richtexts as
    images for a later release.

    You will need to experiment with the new settings available in RB 14 to
    find the right balance between image quality, file size, and generation
    time. The following properties are taken into account when exporting
    images. See the RB help for more information.

    PDFSettings.ImageCompressionLevel
    PDFSettings.ScaleImages
    PDFSettings.MetafileToBitmapQuality
    PDFSettings.UseJPEGCompression

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2013
    Image quality is just one of the two problems. The other,
    OutOfResources, is a showstopper for me.

    About setting MetafileToBitmapQuality set to 1 and ScaleImages to false,
    the image quality seems to be similar to RB 10, but the PDF file size is
    about 4x bigger than RB 10. This 4x diference makes a big diference when
    you think about sending hundreds of emails in a day with reports attached.

    The following settings produces files 10% bigger than rb10, but there is
    noticeable loss of quality in images with plenty of colors.

    ExportRTFAsBitmap:=True;
    MetafileToBitmapQuality:=1;
    ScaleImages:=false;
    ImageCompressionLevel := 100;
    UseJPEGCompression := true;

    I sent to you another sample app that reproduces the EOutOfResources
    error exporting a one page report to PDF, using the default PDFSettings.
    Please check it and get back to me.

    I still think there is some failure in the logic you are using handling
    images in RTF when exporting to PDF. This OutOfResources errors seems to
    be nonsense, specially considering the size of the (small) images that I
    used in the tests.

    It is very frustrating when you spend considerable amount of money to
    upgrade to a new version of the component, and find that things that
    were working fine before started to not work anymore. Right now, I had
    to go back to RB 10, and I really hope to get the necessary fix/patch
    asap, to value my investment. I'm ready to provide any samples you may
    need, and to test any solutions you may send to me.

    Carlos

    Em 22/04/2013 13:21, Nico Cizik (Digital Metaphors) escreveu:
  • edited April 2013
    For anyone following this thread. The issue was resolved with a patch
    for RB 14.08. To obtain the patch, send an email to
    support@digital-metaphors.com.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2013
    Thanks Nico!

    Just a note: Like I already said to you in private, I think something
    still can be improved regarding the export of "Infopower" RTFs
    containing images (without exporting as bitmap). As I showed you in my
    last example with two RTFs containing very similar images, one exports
    fine, the other doesn't. With the patch, both exports fine if I set to
    export as Bitmap, so this will be my workaround for now, but it would be
    nice to not need the workaround at all.

    Carlos

    Em 24/04/2013 10:06, Nico Cizik (Digital Metaphors) escreveu:
  • edited May 2013
    Hello Nico,

    is the eOutOfResources Problem really solved? We have same Problems on
    Terminal-Session-Users and MetafiletoBitmapQuality set to 2...

    Is it not possible that reportbuilder does not shows an exception in
    the case? I think it should programatically possible to catch those
    errors before they appear and change some parameters dynamically so the
    user does not see those messages ... decrease the
    Metafiletobitmapquality or other parameters automatically in those
    cases ...

    We have also a lot of calls from customers ... such a setting would
    save us a lot of annoyance with customers / users ...

    Thanks for your support,

    Yusuf Zorlu



  • edited May 2013
    Yusuf,

    I have sent you the patch that addresses the EOutOfResources error
    described in this thread.

    Since the patch did not solve the issue, it is likely a different
    problem and we will need an example we can run here to track down the
    problem (as explained in our email correspondence).

    For future reference, please use only one support outlet when seeking
    ReportBuilder help (Newsgroups or Email).

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.