'Preview PDF file in a HTML modal, then print to a paper size using PHP or JS

I need some php or javascript script first to display a PDF file in a HTML modal (client browser) and then to print a PDF file from html modal (client browser) to a standard paper size thermal printer whose dimensions (left, margin, top, bottom margin will be hardcoded)

Output result is to print a receipt for restaurant order on a thermal printer or order receipt (PDF file) could also be sent to email. I already have a script that generates order as a PDF file and save it on a server and attaches to a email then sent. I just need php or javascript script to display PDF file as a preview in a html modal and then to let client print the order receipt to a thermal printer.

How can I achieve this?



Solution 1:[1]

A similar question to this one has been asked before on stackoverflow. Check this link if you want.

At least you can get detailed information about viewing pdf file in html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1