Best Way to Print Case Activities
This may or may not meet your requirements, but it's worth noting that there are 2 built-in "print case activities" options currently in CiviCase. You can click the "Print Report" button from the manage case screen, which will print all activities in the main timeline, or you can get finer control from the "Activity Audit" menu which lets you select a timeline and gives you further redaction options before printing.