Paul-DS / bootstrap-year-calendar

[DEPRECATED] A fully customizable year calendar widget, for boostrap !
Apache License 2.0
293 stars 243 forks source link

Printer Friendly? #145

Closed SimonBrazell closed 7 years ago

SimonBrazell commented 7 years ago

Hello,

I'm looking at using this for a project. One of the requirements is that the calendar is printable, do you know if this widget is printer friendly? Sorry if this is mentioned somewhere in the docs, I had a look through them and couldn't see any mention of printing.

Cheers!

SimonBrazell commented 7 years ago

The calendar is not printer friendly as events do not show up, but this was relatively easy to fix using jsPDF, html2canvas and the following function: function exportPDF() { let container = $("#calendar")[0] let height = container.ownerDocument.defaultView.innerHeight; container.ownerDocument.defaultView.innerHeight = container.height; let pdf = new jsPDF(); html2canvas($("#calendar")).then(function(canvas) { container.ownerDocument.defaultView.innerHeight = height; let imgData = canvas.toDataURL("image/png"); pdf.addImage(imgData, 'PNG', 20, 0); }); setTimeout(function() { pdf.save('calendar.pdf'); }, 2000); }

Cheers!