Canvas Client Side Report Printing/PDF

Hi Guys

Wondered if anyone would have any advice/suggestions/ideas on the following?:

I have been experimenting with client side printing of reports from Canvas, trying out some open source javascript libraries.

The ones I have looked at so far:
-pdfMake
-jspdf
-pdfKit
-htmlToCanvas

Does someone perhaps have a specific approach to printing/generating pdfs at client side that you favor above others?
(Or is there maybe already ideas to include printing functionality in canvas down the line?)

The goal is to have ‘pixel perfect’ reports as this is a requirement of one of our customers.

The problem I have currently is pulling in the styles along with the content & having the result give a clear image.

So far pdfMake gives me the closest result.
It does a lot of the heavy lifting and one can quite easily pull in and structure additional content as well along with the canvas data (like company logo images etc)…but unfortunately it still has its limitations.

For example: The library does not allow one to colour the interior of a table cell yet…so you would need to write your own javascript extension within the librarys’ context to get this done.

Any help would be much appreciated.

Thanks in advance!

Regards,

Hi @gpool,

The recommended approach is to use print media queries to customise the look and feel for a printer and then use with the browser (Chrome has a PDF printer) or virtual printer to generate the PDF. Windows 10 has “Microsoft Print to PDF” and there are others you can install in older versions of Windows such as PDFCreator, CutePDF, etc.

Trying to generate PDF on the client or server in code isn’t feasible without lots of work.

1 Like

Thanks Tim, I will look into it.
Regards,