This is a migrated thread and some comments may be shown as answers.

RadGrid Export PDF Font

2 Answers 348 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 19 Jan 2011, 12:13 PM
Hi,

I'm having another problem exporting a radgrid to PDF, it seems to be very flakey. Working one minute and then not another. I get this error when I try to apply a font-family style to either the CommandItem, GridDataItem or GridFooterItem:
System.NullReferenceException: Object reference not set to an instance of an object.
  at Telerik.Web.Apoc.Pdf.PdfFontCreator.CreateBase14Font(String pdfFontID, Base14Font base14)
  at Telerik.Web.Apoc.Pdf.PdfFontCreator.MakeFont(String pdfFontID, Font font)
  at Telerik.Web.Apoc.Pdf.FontSetup.AddToResources(PdfFontCreator fontCreator, PdfResources resources)
  at Telerik.Web.Apoc.Render.Pdf.PdfRenderer.StopRenderer()
  at Telerik.Web.Apoc.StreamRenderer.StopRenderer()
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader) 

This is the code I have in the ItemCreated on the RadGrid:
if (e.Item is GridDataItem)
{
    //e.Item.Style["color"] = "white"; //Default color for headeritem/dataitem
    foreach (TableCell cell in e.Item.Cells)
    {
        cell.Style["font-family"] = "Arial Unicode MS";
        cell.Style["font-size"] = "10px";
    }
}
if (e.Item is GridFooterItem)
{
    foreach (TableCell cell in e.Item.Cells)
    {
        cell.Style["font-family"] = "Arial Unicode MS";
        cell.Style["color"] = "#000";
        cell.Style["font-size"] = "8px";
    }
}
if (e.Item is GridCommandItem)
{
    //.Style["font-weight"] = "bolder";
    e.Item.Style["font-size"] = "10px";
    e.Item.Style["font-family"] = "Arial Unicode MS"; //Set UNICODE font
    //e.Item.Style["color"] = "#990099";
}

The grid exports with the font family set to Arial but the actual font in the pdf export does not change. I've looked at the tips and tricks and can't see anything missing.

Also, this works on the dev server but not on my dev machine (local copy). Am I missing something, does something need to be set installed on the server. Like I mentioned before it does seem flakey.

Thanks

2 Answers, 1 is accepted

Sort by
0
Karl
Top achievements
Rank 1
answered on 19 Jan 2011, 12:26 PM
Quick update, if I use the latest version of the dll it doesn't work, looking through all the changes I made I uploaded the last Telerik dll to the dev server. (2010.3.1109.20) if uploaded an older version in another project (2010.3.309.20)  this version doesn't include the RadButton.

Downloaded lastest version and now it works.

Thanks
0
Daniel
Telerik team
answered on 19 Jan 2011, 01:43 PM
Hello Karl,

This bug was introduced in Q3 2010 - all subsequent versions (starting from RadControls for ASP.NET AJAX Q3 2010 SP1) do not exhibit this problem.
Please excuse us for any inconvenience caused.

Best regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Karl
Top achievements
Rank 1
Answers by
Karl
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or