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

[Solved] Grid Export to PDF error Telerik.Web.Apoc.Render.Pdf.Fonts.Type2CIDSubsetFont.get_WArray()

2 Answers 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Neal
Top achievements
Rank 1
Neal asked on 07 Sep 2009, 12:00 PM
Hi All,

I had the error originally, which prompted the use of <colgroup> <col /> etc.

That unfortunately did not work. (The Detail grid uses GrodBoundColumn and GridCheckboxColumn), the Master TableView originally used <Span> and eval which worked , but which provided me a lack of alignments.
I replaced those <Span> elements with a table and no <colgroup> elements resulting in the error, which needed colgroup to get around it.  But no go.

I get this error now
TIA
Neal

System.NullReferenceException: Object reference not set to an instance of an object.
  at Telerik.Web.Apoc.Render.Pdf.Fonts.Type2CIDSubsetFont.get_WArray()
  at Telerik.Web.Apoc.Pdf.PdfFontCreator.CreateCIDFont(String pdfFontID, Font font, CIDFont cidFont)
  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)


I have checked my C# code to exactly match your examples

 

 

 

protected void grvSchedule_ItemCreated(object sender, GridItemEventArgs e)

 

{

 

if (e.Item.OwnerTableView.Name != "grvAnimalDetl")

 

{

 

foreach (GridDataItem dataItem in e.Item.OwnerTableView.Items)

 

{

 

foreach (TableCell cell in e.Item.Cells)

 

{

cell.Style[

"font-family"] = "Arial Unicode MS";

 

cell.Style[

"text-align"] = "left";

 

cell.Style[

"font-size"] = "12px";

 

cell.Style[

"height"] = "38px";

 

}

}

}

 

if (e.Item.OwnerTableView.Name == "grvAnimalDetl")

 

{

 

if (e.Item is GridDataItem )

 

{

 

foreach (TableCell cell in e.Item.Cells)

 

{

cell.Style[

"font-family"] = "Arial Unicode MS";

 

cell.Style[

"text-align"] = "left";

 

cell.Style[

"font-size"] = "8px";

 

cell.Style[

"height"] = "24px";

 

}

}

 

if (e.Item is GridHeaderItem)

 

{

 

foreach (TableCell cell in e.Item.Cells)

 

{

cell.Style[

"font-family"] = "Arial Unicode MS";

 

cell.Style[

"text-align"] = "left";

 

cell.Style[

"font-size"] = "9px";

 

cell.Style[

"font-weight"] = "bold";

 

cell.Style[

"height"] = "35px";

 

}

}

 

 

if (e.Item is GridCommandItem)

 

{

e.Item.PrepareItemStyle();

//needed to span the image over the CommandItem cells

 

 

 

 

 

}

 

 

}
}

and markup

 

 

 

<

 

telerik:RadGrid ID="grvSchedules"

 

 

runat="server" Width="100%"

 

 

 

 

 

CssClass="GridVClass"

 

 

AutoGenerateColumns="False"

 

 

 

 

 

AllowPaging="True"

 

 

GridLines="None"

 

 

 

 

 

PagerStyle-AlwaysVisible="false"

 

 

 

 

 

 

OnItemCommand="grvSchedule_ItemCommand"

 

 

OnItemDataBound="grvSchedule_ItemDataBound"

 

 

 

 

 

OnDetailTableDataBind="grvSchedule_DetailTableDataBind"

 

 

OnNeedDataSource="grvSchedule_NeedDataSource"

 

 

OnDataBound="grvSchedule_DataBound"

 

 

 

 

 

OnItemCreated = "grvSchedule_ItemCreated"

 

 

 

 

 

HorizontalAlign="Left">

 

 

 

 

 

 

<ExportSettings IgnorePaging="true" >

 

 

 

 

 

<Pdf PageHeight="270mm" PageWidth="540mm" PageTitle="Client Schedule" />

 

 

 

 

 

</ExportSettings>

 

 

 

 

 

<PagerStyle Mode="NumericPages" AlwaysVisible="False">

 

 

 

 

 

</PagerStyle>

 

 

 

 

 

 

<MasterTableView

 

 

Width="100%"

 

 

DataKeyNames="RecId" CellSpacing="1" pagesize="20">

 

 

 

 

 

<DetailTables >

 

 

 

 

 

<telerik:GridTableView

 

 

Name="grvAnimalDetl"

 

 

 

 

 

BorderColor="Gray"

 

 

 

 

 

BorderStyle="Solid"

 

 

 

 

 

BorderWidth="1px"

 

 

 

 

 

DataKeyNames="AnimalId, AnimalTypeId, insval, Val"

 

 

BackColor="LemonChiffon"

 

 

 

 

 

EditMode="InPlace"

 

 

Width="100%" runat="server" CellSpacing="-1"

 

 

GridLines="Horizontal" HierarchyDefaultExpanded="True"

 

 

PagerStyle-Visible="false" >

 

 

 

 

 

 

<Columns>

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="AnimalName"

 

 

HeaderText="Name" UniqueName="AnimalName">

 

 

 

 

 

<ItemStyle HorizontalAlign="Left" Width="130px" Font-Size="XX-Small" />

 

 

 

 

 

<HeaderStyle HorizontalAlign="Left" Width="130px" Font-Size="XX-Small" />

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

 

 

<telerik:GridCheckBoxColumn DataField="AccidentalVC"

 

 

HeaderText="AccidentalVC" UniqueName="AccidentalVC" >

 

 

 

 

 

<ItemStyle Width ="75px" HorizontalAlign="Center" Font-Size="XX-Small" />

 

 

 

 

 

<HeaderStyle Width="75px" HorizontalAlign="Center" Font-Size="XX-Small"

 

 

 

 

 

wrap="True" />

 

 

 

 

 

</telerik:GridCheckBoxColumn>

 

 

</Columns>

 

 

 

 

 

 

<ItemStyle BackColor="White" Font-Names="Times New Roman" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="False" />

 

 

 

 

 

<AlternatingItemStyle BackColor="GhostWhite" Font-Names="Times New Roman" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="False" />

 

 

 

 

 

<HeaderStyle BackColor="LemonChiffon" />

 

 

 

 

 

 

<CommandItemStyle BackColor="LemonChiffon" BorderColor="Gray"

 

 

BorderStyle="Solid"

 

 

 

 

 

BorderWidth="1px" />

 

 

 

 

 

</telerik:GridTableView>

 

 

 

 

 

</DetailTables>

 

 

 

 

 

 

<Columns>

 

 

 

 

 

<telerik:GridTemplateColumn>

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

<table>

 

 

 

 

 

<colgroup>

 

 

<col />

 

 

<col />

 

 

</colgroup>

 

 

 

<tr>

 

 

 

 

 

<td >Animal Details and Covers:

 

 

</td>

 

 

 

 

 

<td >

 

 

 

 

 

</td>

 

 

 

 

 

</tr>

 

 

 

 

 

 

</table>

 

 

 

 

 

<br />

 

 

 

 

 

<br />

 

 

 

 

 

<br />

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

</Columns>

 

 

 

 

 

</MasterTableView>

 

 

 

 

 

 

<ClientSettings>

 

 

 

 

 

<Selecting AllowRowSelect="True" />

 

 

 

 

 

</ClientSettings>

 

 

 

 

 

<AlternatingItemStyle Font-Size="X-Small"></AlternatingItemStyle>

 

 

<ItemStyle Font-Size="X-Small"></ItemStyle>

 

 

</telerik:RadGrid>

 

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 10 Sep 2009, 11:14 AM
Hello Neal,

I created a sample project based on the provided code, but I'm unable to reproduce the problem. Please download the example at your side and let me know if I'm missing something.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Neal
Top achievements
Rank 1
answered on 14 Sep 2009, 01:54 PM

Hi ,

I discovered the problem, it was the style settings in the template column
font-weight:bold;font-family:Arial Black

 

 

<telerik:GridTemplateColumn>

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

<span style="font-weight:bold;font-family:Arial Black; text-align:center;width:100% ">

Many thanks though
Neal

 

Tags
Grid
Asked by
Neal
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Neal
Top achievements
Rank 1
Share this question
or