html5-scheduler-printing.png

The Scheduler supports direct client-side printing of the exported image. 

  • It opens the exported image in a hidden iframe and invokes the browser print dialog.
  • JPEGPNG and SVG image format printing is supported. Use SVG (vector format) for smooth scaling.
  • You can specify the area to be printed using "area" attribute of exportAs() option bag.

JavaScript

Printing the current viewport:

<div id="dp"></div>

<div class="space">
    Format:
    <select id="format">
        <option value="svg">SVG</option>
        <option value="png">PNG</option>
    </select>

</div>
<div class="space">
    <a href="#" id="print-button">Print</a>
</div>

<div id="export"></div>

<script type="text/javascript">

    var dp = new DayPilot.Scheduler("dp");
    
    // ...

    dp.init();
    
    $(document).ready(function() {
        $("#print-button").click(function(ev) {
            ev.preventDefault();
            var format = $("#format").val();
            dp.exportAs(format).print();
        });
    });

</script>

Printing the full Scheduler:

<div id="dp"></div>

<div class="space">
    Format:
    <select id="format">
        <option value="svg">SVG</option>
        <option value="png">PNG</option>
    </select>

</div>
<div class="space">
    <a href="#" id="print-button">Print</a>
</div>

<div id="export"></div>

<script type="text/javascript">

    var dp = new DayPilot.Scheduler("dp");
    
    // ...

    dp.init();
    
    $(document).ready(function() {
        $("#print-button").click(function(ev) {
            ev.preventDefault();
            var format = $("#format").val();
            dp.exportAs(format, { area: "full" } ).print();
        });
    });

</script>

Demo