cheese-fork
cheese-fork copied to clipboard
Pdf print
Export to PDF
Solves Issue #8
Added the ability to export the calendar as a PDF file. The PDF file is being downloaded immediately.
Technical stuff
- The PDF is created with jsPDF and jsPDF-AutoTable (plugin)
- The PDF is textual and not an image
- UTF and RTL support is limited
- Special Javascript font files are also included for this purpose
- Text direction was reversed several times
- I also tried working with other libraries but they had their own problems
- html2pdf.js actually worked well but it generated an image based PDF (using html2canvas) and the file was really heavy
Visual changes
Top navbar:
Not Logged-In


Logged-In

PDF Calendar

Very nice, thank you for the contribution! It looks good overall, but there are a couple of things to be taken care of before it gets merged.
-
Functionality: I tested it briefly, and the most noticeable issue is that the table is limited to the fixed times of 8:30-17:30 and days of Sunday-Thirsday. CheeseFork supports any time and any day of week. You can see that e.g. with the 394902 course which has several late courses, or by dragging a custom event to a different time or day.
-
User interface: I don't like merging "Share" and "Export" to a single menu. Let's keep "Share" ("שיתוף מערכת") as is, and have an "Export" ("ייצוא") item with two options.
-
Code: I'll leave a couple of minor comments in a moment.
PDF feature with all fixes
I fixed the things you @michael-maltsev mentioned in the new commits
- Also now the PDF looks more like the original calendar
- And the code is better documented

I forgot to set the column sizes, so please wait with merging
All done, you can check it out
Thanks. Issues that I've seen from a quick glance:
-
Text of small events (1/2 hour) is not displayed:
-
Also, text of larger events (1 hour) is not vertically aligned:
-
The sharing button is gone, at least when not signed in:
Also, could you rebase the code on the most resent commit?
Rebased everything to a single commit and fixed the things you mentioned.
I didn't mean squashing the commits, I meant rebasing to update to the recent changes of the repository. Not a big deal, I can do it myself later.
More importantly, there are still issues unfortunately:
- Overlapping events aren't handled properly:
-
English text is reversed. You can see that in the image above as well.
-
A single large event screws up the PDF, example:
I didn't spend a lot of time testing it. Please, next time, if possible, play with the solution a bit to see if there are no other things to be done, to save on the ping-pong.
Also, the tooltip from a disabled sharing button is now gone:
Ok, sorry for that, I'll test it properly and next time I hope there won't be problems at all. I will try to cover any possible scenario. Again sorry for the ping pong and for the bad tested code