We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Words 6.0.0 document.Print( printername) need System.Drawing in References

Hello support,

I want to print a docx file with print method.

doc.Print(); compile and run fine

but doc.Print( "myprintername" ); don't compile under Visual Studio 2008.

Compiler error is :

error CS0012: The type 'System.Drawing.Printing.PrinterSettings' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

When I add System.Drawing in References of my project, there is no compiler error.

So, my question is : why System.Drawing is required for doc.print( "myprintername" ) and not for doc.print() ?

Here is my code :

using System;
using Aspose.Words;

namespace PrintConsole
class Program
static void Main(string[] args)
Aspose.Words.License license = new Aspose.Words.License();

Console.WriteLine("Loading docx...");
Aspose.Words.Document doc = new Aspose.Words.Document(args[0]);
doc.Print(args[1]); //printername
Console.WriteLine("Printing ended.");
catch (Exception ex)

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. This occurs because Aspose.Words internally uses PrinterSetting to specify printer. So you should add reference to System.Drawing assembly. You can also specify printer as shown in the following code:

System.Drawing.Printing.PrinterSettings settings = new System.Drawing.Printing.PrinterSettings();

settings.PrinterName = "Microsoft Office Document Image Writer";


Best regards.