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

PDF Export multile pages with header and footer

2 Answers 1392 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Paolo
Top achievements
Rank 1
Paolo asked on 10 May 2016, 01:38 PM

Hello, I am trying to export a document using pdf export feature.

Tests I am doing in on a single three pages html file wich contents are text.

I have used this function:

function getPdf(){
                kendo.drawing.drawDOM($("#temp-container"), {
     paperSize: "A4",
     margin: { left: "0cm", top: "1cm", right: "0cm", bottom: "1cm" },
     template: $("#page-template").html()
 }).then(function (group) {
     // Render the result as a PDF file
     return kendo.drawing.exportPDF(group);
 }).done(function (data) {
     // Save the PDF file
     kendo.saveAs({
         dataURI: data,
         fileName: "HR-Dashboard.pdf",
     });
 
 });
         }

I have created this dojo that creates header and footer, but header is overlapping contents

if I add:

  

#temp-container{            
top:100px;
 bottom:100px;
 position:absolute;       }

In the style, contents are cut in the bottom.

Any suggestions?

 

2 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 11 May 2016, 07:22 AM

Hello Paolo,

My suggestion is to set a top margin to a greater value (3 cm for example). Please refer to the http://dojo.telerik.com/oHEVu example. The top margin is set to "3cm" and header is not overlapping the content anymore. 

margin: { left: "0cm", top: "3cm", right: "0cm", bottom: "1cm" },

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Paolo
Top achievements
Rank 1
answered on 11 May 2016, 09:50 AM

Thank you Doyan for your suggestion.

I did not test margins because I thought were the margins of the entire page.

It works pretty good.

Kind regards

Paolo

Tags
General Discussions
Asked by
Paolo
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Paolo
Top achievements
Rank 1
Share this question
or