Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • Aspose PDF does not allow JavaScript, and straight up just doesn't support absolutely positioned elements
  • PrinceXML has known issues where it throws TypeError exceptions when processing JavaScript that are not reproducible in IE, Chrome or Firefox.

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?

like image 303
John Zabroski Avatar asked Mar 21 '23 22:03

John Zabroski


1 Answers

Your best bet is probably wkhtmltopdf, which uses the WebKit as the rendering engine. This means you can freely use CSS/Javascript. You might need to look into the javascript-delay option.

I have used wkhtmltopdf successfully in Ruby on Rails, but it appears you are using .NET. A quick search reveals some possible wkhtmltopdf wrapper libraries for .NET:

  • gmanny/Pechkin
  • codaxy/wkhtmltopdf

You may want to take a look at this answer for some alternative solutions.

like image 170
nomatteus Avatar answered Apr 25 '23 01:04

nomatteus