Free Support Forum -

Poor Image quality on PDF when coming from Aspose.Chart


I have a problem with Aspose.PDF and Aspose.Chart working together: the image on the PDF is very poor in quality and the print of the PDF is not acceptable. I m developing Financial documents where the quality takes the first place.

Here is the C# code to create the images including them into the pdf:


Chart c = new Chart();

... Chart configurations....

c.Height = 450F;

c.Width = 800F;

... Chart data retrieving ...

// Finally chart saving

MemoryStream ms = new MemoryStream();

c.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);


Pdf _pdf = new Pdf();

... Bind pdf to XML template having the section

sec1 = _pdf.Sections[0];

Aspose.Pdf.Image image = new Aspose.Pdf.Image(sec1);


// GET Image From MEMORY Stream

//Create a BinaryReader object to read bytes from MemoryStream for IMAGES

System.IO.BinaryReader reader = new System.IO.BinaryReader(ms);

//Set the file and open types of the image

image.ImageInfo.ImageFileType = ImageFileType.MemoryBmp;

image.ImageInfo.OpenType = ImageOpenType.Memory;





//Set position

ms.Position = 0;

//Read bytes from the MemoryStream and store as memory data for the image to

//be added to Pdf document

image.ImageInfo.MemoryData = reader.ReadBytes((int)ms.Length);




I tried many of the examples you posted in the forums and in the guideline without results: more of them have the method Save of the Chart to a bitmap (i.e. Bitmap bm = new Bitmap(); bm= chart.Save()) that is no more supported by the last versions.

The section has an header and a footer and is landscape A4 or Letter; the image should occupy the entire page

Please give me a solution since I have to deliver the documents by the end of this month January 2006.

Note that we have bought the Aspose.Total license.



Dear vmax,

Thank you for considering Aspose.

Can you please attach the chart image and let me test it?


I m sorry but I can't send you the chart since are reserved info but you can easily create it with the Aspose.Chart.

You can create a chart you want following your examples ! You only must create it 450x800 and save it into memory stream before adding it to the PDF.

However please find attached a part of the chart taken from the created PDF.

I posted the same problem to the Aspose.Chart support people since I m not sure who is responsible of the poor quality.



Ok. I will test it and reply to you ASAP.

Please try saving the chart into image file and see if you are satisfied with it.


I finally found a way to get best quality in images created by the Aspose.Chart and then imported into the PDF.

Summarizing, to have a good quality of Chart to be imported into the Aspose.Pdf document I had to do:

  • Set big image 900x1600 size
  • Set appropriate font size for the labels, legends, titles accordingly to the big size
  • Set the Series.DefaultDataPoint.BorderWidth to an appropriate value for Curve or Line charts
  • Save the Chart onto the hard disk as PNG
  • Finally import the created image into the PDF by scaling it to an half (ImageScale=0.5F) becoming 450x800

The image is well fit into the PDF page with a good quality in viewing and printing.

I experienced that saving the image into a memory stream they must be imported into the PDF only as MemoryBmp with loss of quality thus I would suggest to anyone not to follow this approach waiting for the support of other formats.

Passing through a hard disk file is slow and make the developer to keep the temporary directory clean and keep the file names unique especially in a web environmemt. I suggest to use the System.Guid as prefix of the chsrts filenames: I used

String _imageFilePath = ServerPath+@"\TemporaryFiles\"+ Guid +".png";

c.Save(_imageFilePath, System.Drawing.Imaging.ImageFormat.Png);

for saving the charts and then

Aspose.Pdf.Image image = new Aspose.Pdf.Image(sec1);


//Set scale

image.ImageScale = 0.5F;

//Set file name and type

image.ImageInfo.File = _imageFilePath;

image.ImageInfo.ImageFileType = ImageFileType.Png;

//Add image to the PDF section


I hope someone else be aided by this threat.

Best Regards


Please refer to We will support memory image for all supported type.


please let me know when a new version supporting all image format will be available.



Dear vmax,

This feature is now supported in the hotfix 2.9.2.