public static void Run()
{
// ExStart:PrintProjectUsingCustomPrinter
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
// Read the input Project file
Project project = new Project(dataDir + "Project2.mpp");
string printerName = "Microsoft Print to PDF";
foreach (string printer in PrinterSettings.InstalledPrinters)
{
if (printer.ToUpperInvariant().Contains(printerName.ToUpperInvariant()))
{
project.Print(printer);
break;
}
}
// ExEnd:PrintProjectUsingCustomPrinter
}
}