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

Grid PDF Export and Binary Image

2 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ihsan
Top achievements
Rank 1
ihsan asked on 19 Jun 2010, 11:10 AM
hi telerik,

i have a grid with one row and one column. this column has a html data.. tables, images and etc..
but one of the image comes from database ( for security reasons )
when i open grid, i can see image in grid but when i want to pdf export there is an error about this image path..
System.Web.HttpException: '/async/display.ashx?id=1043' is not a valid virtual path.

as you can see '/async/display.ashx?id=1043'  streams image from db.

sample code;

<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" 
        OnNeedDataSource="grvSchedule_NeedDataSource" OnItemCreated="grvSchedule_ItemCreated" 
        HorizontalAlign="Left">  
        <ExportSettings IgnorePaging="true" ExportOnlyData="true">  
            <Pdf PageHeight="297mm" PageWidth="210mm" PageTitle="Client Schedule" /> 
        </ExportSettings> 
        <PagerStyle Mode="NumericPages" AlwaysVisible="False"></PagerStyle> 
        <MasterTableView Width="100%" DataKeyNames="RecId" CellSpacing="1" PageSize="20">  
            <Columns> 
                <telerik:GridTemplateColumn> 
                    <ItemTemplate> 
                                    <table width="800px">  
                                        <colgroup> 
                                            <col /> 
                                            <col /> 
                                        </colgroup> 
                                        <tr> 
                                            <td style="color: White;">  
                                                [Fax]<br /> 
                                            </td> 
                                            <td> 
                                            </td> 
                                        </tr> 
                                        <tr> 
                                            <td> 
                                                <img alt="" src="/Images/abc.png" /> 
                                            </td> 
                                            <td> 
                                                </td> 
                                        </tr> 
                                        <tr> 
                                            <td> 
                                                [DateToday]  
                                            </td> 
                                            <td> 
                                            </td> 
                                        </tr> 
                                        <tr> 
                                            <td> 
                                                [COMPANY]  
                                            </td> 
                                            <td>ClientName]                                            </td> 
                                        </tr> 
                                        <tr> 
                                            <td> 
                                                <img alt="" src="/Images/abc_sign.png" /> 
                                            </td> 
                                            <td> 
                                                <img alt="" src="/display.ashx?id=1043" /> 
                                            </td> 
                                        </tr> 
                                        <tr> 
                                            <td> 
                                                [Name]  
                                                <br /> 
                                                Executive Vice President  
                                            </td> 
                                            <td>[Principal]<br />[Title]  
                                            </td> 
                                        </tr> 
                                        <tr> 
                                            <td style="font-size: smaller;" colspan="2">  
                                                <br /> 
                                                [Descriptions]  
                                            </td> 
                                        </tr> 
                                        <tr> 
                                            <td colspan="2" style="color: White;">  
                                                @#  
                                            </td> 
                                        </tr> 
                                    </table> 
                                </td> 
                            </tr> 
                        </table> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
            </Columns> 
        </MasterTableView> 
        <ClientSettings> 
            <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
        <AlternatingItemStyle Font-Size="X-Small"></AlternatingItemStyle> 
        <ItemStyle Font-Size="X-Small"></ItemStyle> 
    </telerik:RadGrid> 

Error ;

System.Web.HttpException: '/async/display.ashx?id=1043' is not a valid virtual path.
  at System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options)
  at System.Web.HttpServerUtility.MapPath(String path)
  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.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.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)


thanks for your help..

2 Answers, 1 is accepted

Sort by
0
Diego
Top achievements
Rank 1
answered on 20 Jun 2010, 09:45 PM
I doubt this will work directly given the fact that the documentation states that the absolute path is a must.
http://www.telerik.com/help/aspnet-ajax/grid-pdf-export.html
0
Daniel
Telerik team
answered on 24 Jun 2010, 02:50 PM
Hello Ihsan,

Please use an absolute path as suggested by Diego - otherwise the PDF engine won't be able to resolve the image.

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
Tags
Grid
Asked by
ihsan
Top achievements
Rank 1
Answers by
Diego
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or