This is the code I used to produce the Pdf.
private
void
AddImage(RadGridView TheGrid, MemoryStream mStream)
{
Image TheImage = System.Drawing.Image.FromStream(mStream);
GridViewImageColumn ImageColumn =
new
GridViewImageColumn();
ImageColumn.ImageLayout = ImageLayout.Stretch;
ImageColumn.Width = 1095;
ImageColumn.IsVisible =
true
;
radGridView1.MasterGridViewTemplate.Columns.Add(ImageColumn);
radGridView1.MasterGridViewTemplate.Rows.Add(TheImage);
radGridView1.Refresh();
}
radGridView1.MasterGridViewTemplate.Columns.Add(Chart);
radGridView1.MasterGridViewTemplate.Rows.Add(ChartImage.Image);
radGridView1.Refresh();
}
private
void
radGridView1_Click(
object
sender, EventArgs e)
{
if
(
this
.radGridView1.Rows.Count != 0)
{
ExportToPDF exporter =
new
ExportToPDF(
this
.radGridView1);
exporter.FileExtension =
"pdf"
;
exporter.ExportVisualSettings =
true
;
exporter.PageTitle =
"Chart"
;
exporter.FitToPageWidth =
true
;
exporter.PdfExportSettings.EnableCopy =
true
;
exporter.SummariesExportOption = SummariesOption.ExportAll;
string
fileName =
"C:\\ExportedData.pdf"
;
exporter.RunExport(fileName);
}
11 Answers, 1 is accepted

As far as I'm aware, the ExportToPDF only currently supports rendering values that can be converted to string.
Regards,
Richard
We do not support exporting images to PDF and Richard is right about the string rendering.
Do not hesitate to contact us again if you have any additional questions.
Greetings,
Martin Vasilev
the Telerik team


I am writing here since I am having the same issue as Steven. I am using the latest components for Winforms (2012.3.1017.40).
I want to export all columns from my radgridiview to Excel and PDF and also print it. Printing is working well but I can't manage to export the GridViewImageColumn to Excel and PDF.
If this feature is not supported, could you please advise me how to export the radgridview to Excel and PDF with the images? Can we add it to the PITS?
Best regards,
Ludovic
Thank you for writing.
Currently the export to HTML/PDF does not support exporting images. I have added a feature request to our Public Issue Tracking System. You can track its progress, subscribe for status change alerts and add your vote/comment on the following link - PITS Feature.
Excel does not support importing images into cells. You can try and import an image into an excel file and you will see that the image is actually floating over the table and is not contained in a particular cell.
I have updated your Telerik points for the good suggestion.
I hope this is useful. Should you have further questions, I would be glad to help.
All the best,
Ivan Petrov
the Telerik team

Maybe you should consider taking a look at telerik reporting exporting to pdf (here)
Adobe PDF
PDF is used for representing two-dimensional documents in a manner independent of the application software, hardware, and operating system. Each PDF file encapsulates a complete description of a fixed-layout 2D document that includes the text, fonts, images, and 2D vector graphics which composeRTF the documents.
Hope this helps
Emanuel Varga
WinForms MVP
As of Q2 2015, we have introduced new export providers utilizing our document processing libraries. The GridViewPdfExport class is used to export RadGridView to a pdf and the images will be exported as expected. More information about this provider is available here: http://docs.telerik.com/devtools/winforms/gridview/exporting-data/export-to-pdf
I hope that you find this information useful.
Regards,
Stefan
Telerik

Hello Stefan,
could you please attach a sample code, because I keep getting the error that I attached on my previous post (error.jpg). In the pdf instead of displaying the image, I get the "System.Byte[]".
Maybe there is something wrong with the code that I use to create the image column on the radgridview? The images are displayed properly on the radgridview, but on the final exported pdf. Part of the code that I use to create the radgridview is the following:
DataTable dataTable_radGridView = new DataTable();
System.Data.DataColumn Column1 = new System.Data.DataColumn("img_fileID", typeof(byte[]));
Column1.Caption = "Image";
dataTable_radGridView.Columns.Add(Column1);
//I get the image raw data from the database
dataTable_radGridView.BeginLoadData();
UInt32 FileSize;
byte[] rawData;
Image ret_image = null;
FileSize = rdr.GetUInt32(rdr.GetOrdinal("img_size"));
rawData = new byte[FileSize];
rdr.GetBytes(rdr.GetOrdinal("img_file"), 0, rawData, 0, (int)FileSize);
MemoryStream ms = new MemoryStream(rawData);
ret_image = new Bitmap(ms);
if (ret_image != null) {
row["img_fileID"] = imageToByteArray(ret_image);
}
ms.Close();
ms.Dispose();
}
dataTable_radGridView.Rows.Add(row);
rdr.Close();
rdr.Dispose();
command.Dispose();
dataTable_radGridView.EndLoadData();
radGridView1.MasterTemplate.BeginUpdate();
radGridView1.DataSource = dataTable_radGridView;
radGridView1.MasterTemplate.EndUpdate();
public static byte[] imageToByteArray(System.Drawing.Image imageIn)
{
MemoryStream ms = new MemoryStream();
imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
return ms.ToArray();
}
//Then I use the code that you suggested (http://docs.telerik.com/devtools/winforms/gridview/exporting-data/export-to-pdf) in order to create the pdf, but with NO success.
Thank you in advance!

my mistake was that I using ExportToPDF instead of GridViewPdfExport that you suggested (sorry... they were both displayed on the same link...)
Please let me know how I can:
1) set the orientation of the page
2) set the page margins
3) wrapText of cells
when GridViewPdfExport is used?
Directly to your questions.
1. GridViewPdfExport features PageSize property where you can determine the size of the page:
exporter.PageSize =
new
System.Drawing.SizeF(297, 210);
2. It also features PageMargins property to set the desired margins:
exporter.PageMargins =
new
System.Windows.Forms.Padding(10, 10, 10, 10);
3. To set the text wrap, you can handle the CellFormatting event of the exporter.
void
exporter_CellFormatting(
object
sender, PdfExportCellFormattingEventArgs e)
{
e.CellElement.TextWrap =
true
;
}
This would also require setting the ExportVisualSettings to true.
In general, if in your grid you have set the text wrapping for the cells, just enabling the visual settings will also transfer this setting, along with all other visual settings (, forecolor, row height, etc) to the exporter file.
I hope that you find this information useful.
Regards,
Stefan
Telerik