Forum Discussion

sticksandtraingles's avatar
sticksandtraingles
Copper Contributor
Mar 20, 2024

C# Automating Printing from Word

I am exploring the use of C# to automate a printing process we currently have.

 

It looks like the PrintOut() method might be able to work for me, but I had a few questions.

Question 1: Can I specify the printer easily in c sharp? I found this stackoverflow question, and it looks a bit complicated to specify a specific printer, but this was from 2012, maybe it is easier now?

 

Question 2: 

Can I specify the save as type dropdown below? I need to specify .png. This screen appears after hitting print on the screen shown in question 1. Reviewing the parameters for PrintOut(), I do not see a way to specify this.

 

Thanks!

 

 

1 Reply

  • Braylons's avatar
    Braylons
    Iron Contributor

    you can specify a printer in C# when printing. The PrintDocument class in the System.Drawing.Printing namespace allows you to set the target printer by setting the PrinterName property.

Resources