'How do I print rendered html from a service on Windows 2016/2019

Is there a way to print an html document (or a pdf) to an installed printer, on a windows server, from a service? E.g. using poweshell? I've tried the Get-Content -Path ./readme.txt | Out-Printer "MyPrinter" option but it only works with text files or prints the files html content.

I need to print the rendered html or rendered pdf!

Any suggestions? Is there any other Powershell option or could a headless browser be used?



Sources

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

Source: Stack Overflow

Solution Source