PDF Export multile pages with header and footer

3 posts, 0 answers
  1. Paolo
    Paolo avatar
    26 posts
    Member since:
    Nov 2015

    Posted 10 May Link to this post

    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. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 11 May Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Paolo
    Paolo avatar
    26 posts
    Member since:
    Nov 2015

    Posted 11 May Link to this post

    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

Back to Top