Hi all,
Until now I had no problem with creating a PDF from an UltraGrid
But lately, and for no apparent reason, since nothing was changed in the dev environment, under certain conditios (number of lines, I guess) I get the following exception
The max number of lines in the grid is 2900 rows by 10 columns.
Again, this is a new error, since until now the code was working OK...my env is VS 2008 Pro.
Infragistics2.Win.v8.2 Versión del ensamblado: 8.2.20082.2022 Versión Win32: 8.2.20082.2022 Código base: file:///C:/Windows/assembly/GAC_MSIL/Infragistics2.Win.v8.2/8.2.20082.2022__7dd5c3163f2cd0cb/Infragistics2.Win.v8.2.dll----------------------------------------Infragistics2.Shared.v8.2 Versión del ensamblado: 8.2.20082.2022 Versión Win32: 8.2.20082.2022 Código base: file:///C:/Windows/assembly/GAC_MSIL/Infragistics2.Shared.v8.2/8.2.20082.2022__7dd5c3163f2cd0cb/Infragistics2.Shared.v8.2.dll----------------------------------------Infragistics2.Win.UltraWinTabbedMdi.v8.2 Versión del ensamblado: 8.2.20082.2022 Versión Win32: 8.2.20082.2022 Código base: file:///C:/Windows/assembly/GAC_MSIL/Infragistics2.Win.UltraWinTabbedMdi.v8.2/8.2.20082.2022__7dd5c3163f2cd0cb/Infragistics2.Win.UltraWinTabbedMdi.v8.2.dll
System.OutOfMemoryException: Se produjo una excepción de tipo 'System.OutOfMemoryException'. en Infragistics.Documents.TTF.Font.GetDataUnsafe(Font font) en Infragistics.Documents.TTF.Font.GetData(Font font) en Infragistics.Documents.Graphics.Font.ToStream() en Infragistics.Documents.PDF.PdfDocument.GetFont(Font font, Boolean embed, Boolean subset) en Infragistics.Documents.PDF.PdfPage.GetFont(Font font, Boolean embed, Boolean subset) en Infragistics.Documents.PDF.PdfGraphics.set_Font(Font value) en Infragistics.Documents.Report.Projection.Text.TextComposition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Tree.NodeComposition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Tree.NodeComposition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.Composition.Draw(IGraphics graphics) en Infragistics.Documents.Report.Projection.ProjectionPage.Draw(IGraphics graphics) en Infragistics.Documents.Report.Report.Publish(Stream stream, FileFormat format) en Infragistics.Documents.Report.Report.Publish(String fileName, FileFormat format)
Thanks in advance!
Gus
Mike,
Thanks for your answer.
Fortunately enough I was able to solve this error (quite difficult to kill!)
The stack trace pointed to a "Font" error, so I guessed that, after trying many other options, the problem must be somewhat related to a memory leak in how the PDF engine works with fonts.
Dim normalStyle As New Infragistics.Documents.Report.Text.Style(New Infragistics.Documents.Graphics.Font("Arial", 7), Infragistics.Documents.Graphics.Brushes.Black) Dim redSubscriptStyle As New Infragistics.Documents.Report.Text.Style(New Infragistics.Documents.Graphics.Font("Arial", 12), Infragistics.Documents.Graphics.Brushes.Red)
The error rises up when I use more than one font type (MS Sans Serif), so now I use only one font and no more errors.
IMHO, the report required more memory because I changed the data structure by adding one more array.
Why the error is erratic, I have no idea, but now is gone for good.
Hope this helps to someone else or to check the report engine.
Thanks!
I have never seen the error message before. But I am guessing that "Rows" here refers to row in the Grids that are created inside the PDF document, not rows in the WinGrid.
A single grid row is translated into a Grid in the PDF document which contains the cells in that row. I can't see how you would ever end up with 2900 rows in a single grid row, though. Unless you were using RowLayouts with a ridiculous number of columns stacked one atop the other.
You say the error is erratic... are you able to reproduce it consistently at all? If so, we would be happy to take a look at a test project demonstrating the problem.
Hi there,
I'm still fighting this issue, since it's affecting every other report.
So far, I'd noticed that:
1) The exporting goes well if the report is empty (no sections, no nothing), just the grid's data.
2) Also if the number of rows is reduced.
This is what I'm doing and worked until now...
Any help is appreciated, so far no answers as how to deal with this very NASTY issue.
Thanks in advance.
Dim prtdoc As New System.Drawing.Printing.PrintDocument Dim strDefaultPrinter As String = prtdoc.PrinterSettings.PrinterName Dim Test_Print_Dialog As System.Windows.Forms.PrintDialog = New PrintDialog() Dim Report_Module As Report = New Report() Dim Section_Module As Infragistics.Documents.Report.Section.ISection = Report_Module.AddSection() Dim ReportName_Test_PDF As String = App_Path + "\Reports\Testing_Test_Results_1.pdf" Dim ReportName_Test_XPS As String = App_Path + "\Reports\Testing_Test_Results_1.xps" Dim ReportName_Test_XLS As String = App_Path + "\Reports\Testing_Test_Results_1.xls" Dim UGDE As New Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter
Me.Create_Report_Test_R1(Report_Module, Section_Module) UGDE.Export(Me.UltraGrid_Results_1, Section_Module)
Try Cursor.Current = Cursors.WaitCursor Select Case e.Tool.Key Case "Print" If Test_Print_Dialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then Report_Module.Print(strDefaultPrinter) End If Case "XPS" Report_Module.Publish(ReportName_Test_XPS, Infragistics.Documents.Report.FileFormat.XPS) System.Diagnostics.Process.Start(ReportName_Test_XPS) Case "Excel" UGEE.Export(Me.UltraGrid_Results_1, ReportName_Test_XLS) System.Diagnostics.Process.Start(ReportName_Test_XLS) Case "PDF" Report_Module.Publish(ReportName_Test_PDF, Infragistics.Documents.Report.FileFormat.PDF) System.Diagnostics.Process.Start(ReportName_Test_PDF) End Select Catch ex As System.IO.IOException MessageBox.Show(msg32, msg_app_name, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) Finally Cursor.Current = Cursors.Default End Try
It's also important to note, that the current rows total is 700, not 2900 as stated before...
On the other hand, this exception is raised on a random basis...
My dev machine has 4Gb, running Vista.
I really need any help to sort this out...