This question already has an answer here:
I have created a form. Whenever someone pastes the url of a website such as https://google.com in that form and after hitting the submit button, it will convert the webpage to pdf and prompt us to save in the disk. Can anyone please tell me how to do this ? I know about DOMPDF
</div>
You can try HTML2PDF library - Html2PDF - We have had good luck with that - however there are several caveats with using it -