I'm trying to print an HTML file that includes images and text, all stored locally on my PC. I want to keep the layout exactly as it is. I've heard that the Out-Printer command only works for text. Is there a different method I can use to accomplish this?
5 Answers
Using Edge in kiosk mode is another great option! It opens your HTML file full screen and skips the print dialog, sending it straight to the default printer. Here's a quick script to set it up:
You might need a different approach. A good way to go about it is by using a COM object like mshtml or edgeview2. You can load your HTML file into it and then print directly from there.
If I were you, I would convert the HTML to a PDF and set up printer sharing on your network. Then you can print it using a command like this in CMD: `copy file.pdf \localhostprinter-name` if needed.
I recommend using wkhtml2pdf to convert your HTML file into a PDF first, then print the PDF using the print command or by copying it to a print share. This way, you'll preserve the layout.

I agree! Converting to PDF is a solid move. It makes printing so much easier and the formatting stays intact.