Free Support Forum -

GDI+ Error

I am getting a “generic error occured in GDI+” when trying to create a pdf document with 3 charts per page and about 90 pages.

If I comment out the graphic code it works fine , no GDI+ error or System out of memory exceptions.

I really need help to get this work as soon as possible. I have clients waiting for this.

Does anyone see anything wrong with the way I am handling the image or something that would be causing these errors??

Any Help is appreciated.


P.S. I am using version of Aspose.PDF, Is there any know problems for images coming into the pdf very small?

I have to set the image to 1000 x 700 to get any sort of viewable image.

Here is the code for my image creation and adding to the pdf. This occurs in a loop.

Dim c As ChartDirector.XYChart = New ChartDirector.XYChart(1000, 700)

c.setPlotArea(50, 40, 930, 610)

c.xAxis.setLabelStyle(“arial.ttf”, 18, Chart.CColor(System.Drawing.Color.Black))

c.yAxis.setLabelStyle(“arial.ttf”, 18, Chart.CColor(System.Drawing.Color.Black))

Dim colors() As Integer = {&HB8BC9C, &HECF0B9, &H999966, &H333366, &HC3C3E6, &H594330, &HA0BDC4}

c.setColors(8, colors)

Dim data(1) As Double

data(0) = srow(y).Item(“Prev_Rit”)

data(1) = ddrow(0).Item(“Prev_Rit”)

Dim layer As Layer = c.addBarLayer2()

layer.addDataSet(data, -1, “Fall”)

data(0) = srow(y).Item(“RIT”)

data(1) = ddrow(0).Item(“RIT”)

layer.addDataSet(data, -1, “Spring”)

c.xAxis.addLabel(0, “S”)

c.xAxis.addLabel(1, “D”)



layer.setDataLabelStyle(“Arial.ttf”, 16)

c.yAxis.setLinearScale(180, Chart.NoValue)

c.addLegend(380, 650, False, “arial.ttf”, 18)

c.addTitle(Chart.TopCenter, srow(y).Item(“MeasureCategory”) & "
Spring " & Request(“syr”) - 1 & " - Spring " &
Request(“syr”), “arial.ttf”, 24)


'Here is where I add the chart to the pdf in a table cell


Dim bm As Bitmap = c.makeImage

Dim mstream As System.IO.MemoryStream = New System.IO.MemoryStream

bm.Save(mstream, System.Drawing.Imaging.ImageFormat.Bmp)

Dim reader As System.IO.BinaryReader = New System.IO.BinaryReader(mstream)

Dim image1 As Aspose.Pdf.Image = New Aspose.Pdf.Image

tab1.Rows(tab1.Rows.Count - 1).Cells(0).Paragraphs.Add(image1)

image1.ImageInfo.ImageFileType = ImageFileType.MemoryBmp

image1.ImageInfo.OpenType = ImageOpenType.Memory

mstream.Position = 0

image1.ImageInfo.MemoryData = reader.ReadBytes(CType(mstream.Length, Integer))

image1.ImageHeight = 700

image1.ImageWidth = 500

image1.ImageScale = 1.0F



Thank you for considering Aspose.

Can you please try the latest version (3.1.0)? This bug should be fixed.


I have tried to test this new version however it appears that our subscription has run out. How can I get this fix?

You can contact the sale department to get new license if your license is old.


In testing, I am getting the same errors.

The “generic error in GDI+” has not gone away and if I set my pictures to a smaller size they are not legible at all.

I have tried running it without placing the graphics in the pdf only
creating them to memory and it runs fine. The error only occurs when I
create an aspose.pdf.image from a bmp in memory and add it to the pdf.

Please help


Dear Ray,

As you can see from the API document, the ImageInfo.MemoryData is absolete. Please refer to the new example of Chart2Pdf at

If it still won't work, please let me know.