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=2.0.0.0, 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();
license.SetLicense("Aspose.Words.lic");
try
{
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)
{
Console.WriteLine(ex.Message);
}
}
}
}