Initially tried it using pdfkit, but it doesn't support @page so the styles which are given for printed documents are not included in the result. Can someone provide an alternative for the above issue? Thanks in advance.
Use WeasyPrint
WeasyPrint is a visual rendering engine for HTML and CSS that can export to PDF