Skip to content
Advertisement

Outputting database items to a pdf document

I have currently generated a Trial Balance with Pastel Database items on a web page as per the below image.

I need to add a button that will be able to download the exact same thing onto a pdf document.

trb.html:

JavaScript

Views.py:

JavaScript

What it needs to print:

enter image description here

If anybody has any way to assist with this or easy way to implement this button , please share.

Advertisement

Answer

I had a similar problem and this is how I solved I used xhtml2pdf library like this,

view

JavaScript

In your HTML file. use the current one you have

This will generate a pdf

Advertisement