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

Kendo grid PDF export

3 Answers 367 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Asmir
Top achievements
Rank 1
Asmir asked on 16 Mar 2018, 10:32 AM

Hi,

how to setup margin element for PDF export using tag helpers? 

<pdf 
                    all-pages="true" 
                    avoid-links="true"
                    landscape="true"
                    repeat-headers="true"
                    paper-size="A4"
                    scale="1"
                    template-id="pdf-export-template" 
                    file-name="Example.pdf" 
                    proxy-url="PdfExport"
                    margin="????"/>

Kind regards,
Asmir

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 20 Mar 2018, 10:07 AM
Hi Asmir,

The margins can be configured with the grid-pdf-margin tag. Check out the code snippet below that illustrates the approach:

<pdf all-pages="true"
 avoid-links="true"
 landscape="true"
 repeat-headers="true"
 paper-size="A4"
 scale="1"
 template-id="pdf-export-template"
 file-name="Example.pdf"
 proxy-url="PdfExport">
    <grid-pdf-margin top="10" bottom="10" left="20" right="20" />
</pdf>

Give the approach a try and let me know how it works for you.


Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Asmir
Top achievements
Rank 1
answered on 20 Mar 2018, 11:19 AM

It's a little bit weird with these angle braces, but it works, thank you. There is one more problem with client template, "header" part of client template actually appears in the bottom of the page, bellow exported content.


<script type="x/kendo-template" id="pdf-export-template">
    <div class="page-template">
        <div class="header">
            <div style="float: right">Page #: pageNum # of #: totalPages #</div>
            Example
        </div>
    </div>
</script>

Regards,

Asmir 

0
Viktor Tachev
Telerik team
answered on 23 Mar 2018, 08:39 AM
Hi Asmir,

In order to specify the position of the items in the export template it is necessary to specify the CSS that will style the page. Please check out the example below that illustrates the approach:


Note how the positions of the header and footer are defined in the CSS styles that are on the page.


Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Asmir
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Asmir
Top achievements
Rank 1
Share this question
or