Depends on the framework you are using. For example, for NodeJS or Python you can use puppeteer for free. For c# or Java you can use the iText library. Or you can use an html to pdf api like https://pdfgate.com