New to Kendo UI for jQuery? Download free 30-day trial

PDF Export with Different Options

Environment

Product Progress Kendo UI Drawing API
Created with Version 2016.3.1028

Description

How can I export some pages with landscape orientation and others with portrait orientation?

Solution

  1. Create a new kendo.drawing.Group()
  2. Call the drawDOM() method and chain the other pages export
  3. Append the resulting group to the root group
    <div id="page1" class="new-page">Page 1</div> 
    <div id="page2" class="new-page">Page 2</div> 
    <script>
        var root = new kendo.drawing.Group();
        kendo.drawing.drawDOM('#page1', {
          paperSize: 'A4',
          margin: '1cm'
        }).then(function (group) {
          root.append(group);

          kendo.drawing.drawDOM('#page2', {
            paperSize: 'A4',
            margin: '1cm',
            landscape: true
          }).then(function (group) {
            root.append(group);

            root.options.set("pdf", {
              multiPage: 'true'
            });

            kendo.drawing.pdf.saveAs(root, "test.pdf");
          });
        });
    </script>
In this article
Not finding the help you need? Improve this article