pdf-generationfullcalendarprincexml

Can FullCalendar be printed to PDF?


I have tried printing FullCalendar.js rendered calendars to PDF, however none of the generators available seem to work:

My minimal repro example for PrinceXML failure is the examples on Adam Shaw's FullCalendar site. Even when I save the generated HTML (via $("body").html()) and pass the generated HTML to PrinceXML, thus bypassing PrinceXML's incorrect JavaScript handling, PrinceXML doesn't lay out the absolutely positioned events correctly.

What are my options?


Solution

  • My coworker found a simpler solution.

    As it turns out, we ran into issues using Pechkin and wkhtmltopdf in test environments. Plus, it required us to set up an additional App Pool just to handle printing to PDF.

    Use html2canvas.js library

    Convert the canvas to base64. I recommend Fred Palmer's base64.js

    Send base64 encoded value to server

    Create web service that calls your PDF converter library. We use Aspose, and so all we do is add the image to an Aspose PDF object.

    PROFIT!

    This solution is incredibly slick, since it uses the user's own rendering engine to generate the PDF. This means WYSIWYG (What You See Is What You Get), so if the calendar looks good when the user uses it, it should print the same exact way! MONEY.