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

Frustrating error when exporting radgrid to pdf

5 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
louis chan
Top achievements
Rank 1
Iron
louis chan asked on 16 Jul 2010, 05:30 AM
Hi all,

I have a radgrid to export my grid to pdf. Before adding image column, it can be exported to pdf. After the image column added, it produces the following error. Do I miss something that needed to be set? Such as IIS configuration, web.config......

v.2010.1.519.35
Error:

System.Exception: Missing ICC_PROFILE identifier in APP2 block
  at Telerik.Web.Apoc.Image.JpegParser.ReadICCProfile()
  at Telerik.Web.Apoc.Image.JpegParser.Parse()
  at Telerik.Web.Apoc.Image.ApocImage.ExtractImage(Bitmap bitmap)
  at Telerik.Web.Apoc.Image.ApocImage..ctor(String href, Byte[] imageData)
  at Telerik.Web.Apoc.Image.ApocImageFactory.Make(String href)
  at Telerik.Web.Apoc.Fo.Flow.ExternalGraphic.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableCell.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableRow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
  at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement()
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.SystemException: System.Exception: Missing ICC_PROFILE identifier in APP2 block
  at Telerik.Web.Apoc.Image.JpegParser.ReadICCProfile()
  at Telerik.Web.Apoc.Image.JpegParser.Parse()
  at Telerik.Web.Apoc.Image.ApocImage.ExtractImage(Bitmap bitmap)
  at Telerik.Web.Apoc.Image.ApocImage..ctor(String href, Byte[] imageData)
  at Telerik.Web.Apoc.Image.ApocImageFactory.Make(String href)
  at Telerik.Web.Apoc.Fo.Flow.ExternalGraphic.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableCell.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableRow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
  at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement()
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SystemException: System.Exception: Missing ICC_PROFILE identifier in APP2 block
   at Telerik.Web.Apoc.Image.JpegParser.ReadICCProfile()
   at Telerik.Web.Apoc.Image.JpegParser.Parse()
   at Telerik.Web.Apoc.Image.ApocImage.ExtractImage(Bitmap bitmap)
   at Telerik.Web.Apoc.Image.ApocImage..ctor(String href, Byte[] imageData)
   at Telerik.Web.Apoc.Image.ApocImageFactory.Make(String href)
   at Telerik.Web.Apoc.Fo.Flow.ExternalGraphic.Layout(Area area)
   at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
   at Telerik.Web.Apoc.Fo.Flow.TableCell.Layout(Area area)
   at Telerik.Web.Apoc.Fo.Flow.TableRow.Layout(Area area)
   at Telerik.Web.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area)
   at Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area)
   at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
   at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
   at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area)
   at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
   at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
   at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement()
   at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)]
   Telerik.Web.Apoc.ApocDriver.FireApocError(String message) +122
   Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader) +951
   Telerik.Web.Apoc.ApocDriver.Render(XmlReader inputReader, Stream outputStream) +293
   Telerik.Web.Apoc.ApocDriver.Render(TextReader inputReader, Stream outputStream) +61
   Telerik.Web.UI.Grid.Export.TableViewExporter.PdfExportRenderForm(HtmlTextWriter nullWriter, Control form) +2020
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +8676409
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
   System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
   Telerik.Web.UI.Grid.Export.TableViewExporter.PdfExportRenderPage(HtmlTextWriter nullWriter, Control page) +146
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +693
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266


Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082

Here is the mark-up

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" 
                    GridLines="None" DataSourceID="ObjectDataSource1" AllowPaging="True" 
                    AllowSorting="True" PageSize="20">
                    <ExportSettings IgnorePaging="true" OpenInNewWindow="true">
                        <Pdf PageHeight="297mm" PageWidth="210mm" PageTitle="Pic" />
                    </ExportSettings>
                    <MasterTableView CommandItemDisplay="Top">
                    <CommandItemSettings ShowExportToPdfButton="true" ShowAddNewRecordButton="false" ShowExportToExcelButton="true" ShowExportToWordButton="true"/>
                    <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>
                      
                    <ExpandCollapseColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridBoundColumn DataField="UserID" HeaderText="User ID" ReadOnly="True" 
                                SortExpression="UserID" UniqueName="UserID">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" 
                                ReadOnly="True" SortExpression="FirstName" UniqueName="FirstName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" 
                                ReadOnly="True" SortExpression="LastName" UniqueName="LastName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="OtherName" HeaderText="Other Name" 
                                ReadOnly="True" SortExpression="OtherName" UniqueName="OtherName">
                            </telerik:GridBoundColumn>
                            <telerik:GridDateTimeColumn DataField="dateTime" HeaderText="Date Time" 
                                ReadOnly="True" SortExpression="dateTime" UniqueName="dateTime" DataFormatString="{0:yyyy/MM/dd HH:mm}" >
                            </telerik:GridDateTimeColumn>
                            <telerik:GridTemplateColumn DataField="FileName" HeaderText="Image" SortExpression="FileName"
                                UniqueName="FileName">
                                <ItemTemplate>
                                    <asp:Image ID="FileName" runat="server" ImageUrl='<%# String.Format("~/Capture/{0}", Eval("FileName")) %>'
                                            Width="100px" Height="70px" BorderWidth="1px" BorderColor="Black" AlternateText="image" />
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>

<script type="text/javascript" language="javascript">
        function requestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportToPdfButton") > 0 || args.get_eventTarget().indexOf("ExportToWordButton") > 0 || args.get_eventTarget().indexOf("ExportToExcelButton") > 0)
                args.set_enableAjax(false);
        }
    </script>
</head>
<body>
    <form id="form2" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
      
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="requestStart">
    </telerik:RadAjaxManager>

5 Answers, 1 is accepted

Sort by
0
louis chan
Top achievements
Rank 1
Iron
answered on 16 Jul 2010, 07:06 AM
Also, if I use hard code "<img src="../Images/mainbar8.gif" />" instead of the databound asp:image, it works perfectly.
0
Daniel
Telerik team
answered on 16 Jul 2010, 12:51 PM
Hello Louis,

Please provide a runnable sample project that demonstrates the issue. This way we will be able to debug it locally and find out the problem.

Best regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
louis chan
Top achievements
Rank 1
Iron
answered on 16 Jul 2010, 04:08 PM
Hi Daniel,
Thx for the reply! I think it is hard to provide some of the code because the dataset class is encrypted to dll and no way to set it's connection string.
I have followed the format of the example provided by telerik. So I have guessed it should be wrong of my IIS server setting. Would u please provide me a simple example to present this exporting to pdf with access and objectdatasource and anything that I should be known to set so that I can compare with my project? Many Thx!

Regards.
0
Daniel
Telerik team
answered on 16 Jul 2010, 09:55 PM
Hello Louis,

I believe the problem is not related to your IIS settings. Either there is something wrong in your approach or there is a bug in the PDF engine. This is why I asked that you provide a runnable demo - since this is not a common problem I need to debug your code in order to provide a workaround.
I don't need the whole project but just a stripped version that illustrates the issue.

Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Marlon Santos
Top achievements
Rank 1
answered on 03 Jun 2011, 03:40 PM
Any solutions to this issue yet?
Tags
Grid
Asked by
louis chan
Top achievements
Rank 1
Iron
Answers by
louis chan
Top achievements
Rank 1
Iron
Daniel
Telerik team
Marlon Santos
Top achievements
Rank 1
Share this question
or