
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.
JPEG, PNG and SVG image format printing is supported. Use SVG (vector format) for smooth scaling.
You can specify the area to be printed using the
options.areaproperty when calling the exportAs() method.
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
Availability
Availability of this feature in DayPilot editions:
| Lite | Pro | |
|---|---|---|
| DayPilot for JavaScript | ||
| DayPilot for ASP.NET WebForms | ||
| DayPilot for ASP.NET MVC | ||
| DayPilot for Java |
DayPilot