Export to PDF performance issues

3 posts, 0 answers
  1. Caroline
    Caroline  avatar
    2 posts
    Member since:
    May 2014

    Posted 15 Jul 2015 Link to this post

    Hello,

    We are using Telerik Grid control and having performance issues with the PDF export.
    The details:

    • Grid control is used in a webpart under SharePoint 2013
    • Datasource is a SQL table, but accessing via ORM (LLBLGen Pro framework)
    • It is a Master-Detail view (details are closed by default and not exported to PDF) - source code attached below
    • It takes 60 seconds to generate a PDF from ~7000rows (it will be a ~24Mb PDF file, ~700pages)

    I did some profiling from the C# webpart side and from the DB side too.
    As you can see in the attachments there is only one SQL query which takes less than a second (381ms) to get the data.

     

    1.EventClass  StartTime   EndTime Duration (ms)   TextData    Reads   Writes  RowCounts
    2.Trace Start 2015-07-14  15:15:33.577                       
    3.SQL:BatchCompleted  2015-07-14  15:15:33.577    2015-07-14  15:15:33.957    381 SELECT xx   1023    0   7632
    4.Trace Stop  2015-07-14 15:15:33.957                    

    But the other attachment is about the hot path in the code and it clearly shows that the Grid's internal methods are working hard for 60 seconds (!) to produce the PDF.

    • Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode
    • Telerik.Web.UI.Grid.Export.TableViewExporter.PrepareForExportInternal

    These two methods are running 98% percent of the time.

    I've created an excel file with MS Excel 2010 on my local machine with the same data and saved it as a PDF. It took less then 10 seconds to generate and save the file.

    Is it possible to increase the export's performance and decrease the necessary time to ~15 seconds?
    What can cause this long rendering time? Maybe the master-detail view?

    Thanks for your tips in advance!

     

    <telerik:RadGrid ID="RadGrid_BoatGrid" runat="server"
        Skin="Metro"
        OnNeedDataSource="RadGrid_BoatGrid_OnNeedDataSource"
        AllowPaging="True"
        OnDetailTableDataBind="RadGrid_BoatGrid_OnDetailTableDataBind"
        EnableLinqExpressions="True">
        <ExportSettings IgnorePaging="True" OpenInNewWindow="True" HideStructureColumns="True">
            <Pdf DefaultFontFamily="Arial" PageWidth="297mm" PageHeight="210mm" PageTitle="Boats" PaperSize="A4"></Pdf>
        </ExportSettings>
        <MasterTableView AutoGenerateColumns="False"
            NoMasterRecordsText="There are no Boats."
            AllowSorting="True"
            DataKeyNames="Id">
            <DetailTables>
                <telerik:GridTableView runat="server" Name="Actions" DataKeyNames="Id" Width="100%" AutoGenerateColumns="False"
                    NoDetailRecordsText="There are no Actions associated with this Boat.">
                    <Columns>
                        <telerik:GridTemplateColumn UniqueName="ActionNumber"
                            HeaderText="Number"
                            DataField="Id">
                            <ItemTemplate>
                                ................
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        ..............
                        <telerik:GridBoundColumn HeaderText="% Complete" DataField="PercentComplete">
                        </telerik:GridBoundColumn>
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
               .......
                <telerik:GridBoundColumn UniqueName="Title"
                    HeaderText="Title"
                    DataField="Title"
                    SortExpression="Title">
                    <HeaderStyle Width="160px"></HeaderStyle>
                </telerik:GridBoundColumn>
                .......
     
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2448 posts

    Posted 20 Jul 2015 Link to this post

    Hi Caroline,

    The structure that you have with the detail tables is rather complex and if those detail tables are expanded, it is expected to see such slow exporting to PDF and there is nothing that could be suggested to speed that up with the built-in exporting.

    However, you can try to manually create your PDF file with the PdfProcessing Library. Detailed information on the library and how to use it could be found in the following help articles:
    Hope this helps.


    Regards,
    Konstantin Dikov
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. Caroline
    Caroline  avatar
    2 posts
    Member since:
    May 2014

    Posted 20 Jul 2015 Link to this post

    Thanks! I will check PdfProcessing library and let you know the results!
Back to Top