Printing a document to a printer

How do I send a file for printing to the printer by its name? In python, it’s simple : os.startfile(“D:\TestPrint\testPrint.docx”, “print”)

os.startfile in python is only available for Windows.

Most parts of the stdlib in go though are more targeted to Linux like systems.

You might need to implement it by yourself.

As I do not have windows, I can’t help you out with that though.

1 Like

It looks like WireGuard implemented a wrapper around Windows’ ShellExecute which is the same underlying Windows function that Python’s os.startfile calls: wireguard-windows/shellexecute.go at master · WireGuard/wireguard-windows · GitHub

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.