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

Pdf export

6 Answers 126 Views
Grid
This is a migrated thread and some comments may be shown as answers.
arun
Top achievements
Rank 1
arun asked on 19 Oct 2018, 02:43 PM

.net core kendo ui

grid has a toolbar template however on pdf export by default it should export with toolbar template but its not, i am not hiding it on export either 

is there anything i am missing

.ToolBar(toolbar =>  {    toolbar.ClientTemplateId("PatientGridToolbarTemplate");                   

 })                           .Columns(columns 

6 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 24 Oct 2018, 10:43 AM
Hello Arun,

When the "paperSize" property of the PDF configuration is set, the toolbar and the pager will not be exported and I have to say that the only workaround that I could suggest is to remove it (if it is applicable):
Please excuse us for any inconvenience caused by this limitation.


Regards,
Konstantin Dikov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
arun
Top achievements
Rank 1
answered on 29 Oct 2018, 03:59 PM

Hi Dikov,

i have the below settings, however i still dont see toolbar  is there anything i am missing

  .ToolBar(toolbar =>
                     {
                         toolbar.ClientTemplateId("PatientGridToolbarTemplate");
                     })

 .Pdf(p=>p.FileName("MockReport.pdf"))

0
Konstantin Dikov
Telerik team
answered on 01 Nov 2018, 11:49 AM
Hi Arun,

Could you please share the entire configuration of the Grid and if possible, a runnable sample project replicating the issue, so we can test and debug it locally?

Looking forward to your reply.


Regards,
Konstantin Dikov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
arun
Top achievements
Rank 1
answered on 01 Nov 2018, 08:12 PM

Hi Dikov,

here is the template

<script id="PatientGridToolbarTemplate" type="text/x-kendo-template">
    <div class="k-toolbar">
        <div style="border:1px solid black;width:35%;float:left;padding:10px;">
            <div>Scenario: <b>@ViewBag.Rule</b></div>
            <div>Description: <b>@ViewBag.RuleDescription</b></div>
            <div>
                <div style="float:left">
                    Run Date:  <b>@DateTime.Now.ToShortDateString() </b>
                </div>
                @if (Common.HasClaim("ViewRule", "1"))
                {
                    <div style="float:right;padding-left:20px;">
                        Rule Version: <a id='RulebyVersion' style='color:black;text-decoration:none' href='/Rule/DisplayRule?RuleId=@Model&ViewActive=true'><b>@ViewBag.RuleVersion</b></a>
                    </div>
                }
                else
                {
                    <div style="float:right;padding-left:20px;">
                        Rule Version: <b>@ViewBag.RuleVersion</b>
                    </div>
                }
            </div>
            <br />
            <div>Data Ingestion:  <b>@ViewBag.DataIngestion.ToShortDateString()</b></div>
            <div> Rule Engine:  <b>@ViewBag.RuleEngine</b></div>
        </div>
        <div style="border:1px solid black;float:right;width:20%;padding:10px;margin-right: 5%;">
            <div> Total Patient Population:  <b id="TotalPatients">@ViewBag.TotalPatients</b></div>
            <div>
                <div style="float:left"> Matching Patient Population: @ViewBag.Percentage <b id="MatchingPatients"></b> </div> <div style="float:right;"> <b id="MatchingPercentage"></b></div>
            </div>
        </div>
        <div style="float:left;width:100%;padding-bottom:5px">
            <div style="float:left;width:30%;padding:4px;">
                <a role="button" class="k-button k-button-icontext k-grid-excel" href="\\#"><span class="k-icon k-i-file-excel"></span>export to excel</a>
                <a role="button" id="gridExportPdf" class="k-button k-button-icontext k-grid-pdf" href="\\#"><span class="k-icon k-i-file-pdf"></span>export to pdf</a>
            </div>
        </div>
    </div>
</script>

here is the grid settings I have, grid has 10fields

    .ToolBar(toolbar =>
                     {
                         toolbar.ClientTemplateId("PatientGridToolbarTemplate");
                     })

 .Pdf(p=>p.FileName("MockReport.pdf"))

0
Konstantin Dikov
Telerik team
answered on 06 Nov 2018, 11:56 AM
Hi Arun,

There could be some CSS that explicitly hides the toolbar on export, because with the above settings, the toolbar is exported as expected on my side:
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.Customer>()
        .Name("grid")
                   .ToolBar(toolbar =>
                     {
                         toolbar.ClientTemplateId("PatientGridToolbarTemplate");
                     })
        .Pdf(pdf => pdf
            .AllPages()
            .FileName("someFileName.pdf")
        )

You could check if you have the following somewhere in your project:
.k-pdf-export .k-grid-toolbar,
.k-pdf-export .k-pager-wrap
{
    display: none;
}



Regards,
Konstantin Dikov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
arun
Top achievements
Rank 1
answered on 15 Nov 2018, 03:54 PM

thank you,

i finally found the prob

Tags
Grid
Asked by
arun
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
arun
Top achievements
Rank 1
Share this question
or