Print

Print()

Prints project to the default printer with default printer settings using the standard (no User Interface) print controller.

public void Print()

Examples

Shows how to print a project.

var project = new Project(DataDir + "Project2.mpp");
project.Print();

See Also


Prints project to the default printer with default printer settings and custom save options using the standard (no User Interface) print controller.

public void Print(PrintOptions options)
ParameterTypeDescription
optionsPrintOptionsthe specified instance of the PrintOptions class.

Examples

Shows how to print a project by using of print options.

var project = new Project(DataDir + "Project2.mpp");

var options = new PrintOptions
{
    Timescale = Timescale.ThirdsOfMonths
};
if (project.GetPageCount(Timescale.ThirdsOfMonths) <= 280)
{
    project.Print(options);
}

See Also


Prints project to the specified printer with default printer settings using the standard (no User Interface) print controller.

public void Print(string printerName)
ParameterTypeDescription
printerNameStringSpecified printer name.

Examples

Shows how to print the project on the selected printer.

var project = new Project(DataDir + "Project2.mpp");

foreach (string printer in PrinterSettings.InstalledPrinters)
{
    if (!printer.ToUpperInvariant().Contains("Microsoft Print to PDF".ToUpperInvariant()))
    {
        continue;
    }

    project.Print(printer);
    break;
}

See Also


Prints project according to the specified printer settings using the standard (no User Interface) print controller.

public void Print(PrinterSettings printerSettings)
ParameterTypeDescription
printerSettingsPrinterSettingsthe specified instance of the PrinterSettings class.

Examples

Shows how to use printer settings to print the project.

var project = new Project(DataDir + "Project2.mpp");

// Print first two pages
var settings = new PrinterSettings
{
    PrintRange = PrintRange.SomePages,
    FromPage = 1,
    ToPage = 2
};

project.Print(settings);

See Also


Prints project according to the specified printer settings using the standard (no User Interface) print controller.

public void Print(PrinterSettings printerSettings, string documentName)
ParameterTypeDescription
printerSettingsPrinterSettingsthe specified instance of the PrinterSettings class.
documentNameStringthe document name to display (for example, in a print status dialog box or printer queue).

Examples

Shows how to use printer settings and a document name to print the project.

var project = new Project(DataDir + "Project2.mpp");

// Print first two pages
var settings = new PrinterSettings
{
    PrintRange = PrintRange.SomePages,
    FromPage = 1,
    ToPage = 2
};

project.Print(settings, "Document #1");

See Also


Prints project according to the specified printer settings and custom save options using the standard (no User Interface) print controller.

public void Print(PrinterSettings printerSettings, PrintOptions options)
ParameterTypeDescription
printerSettingsPrinterSettingsthe specified instance of the PrinterSettings class.
optionsPrintOptionsthe specified instance of the PrintOptions class.

Examples

Shows how to use printer options and settings to print the project.

var project = new Project(DataDir + "Project2.mpp");

var options = new PrintOptions
{
    Timescale = Timescale.Months
};

// Print first two pages
var settings = new PrinterSettings
{
    PrintRange = PrintRange.SomePages,
    FromPage = 1,
    ToPage = 2
};

project.Print(settings, options);

See Also


Prints project according to the specified printer settings, custom save options and the specified document name using the standard (no User Interface) print controller.

public void Print(PrinterSettings printerSettings, PrintOptions options, string documentName)
ParameterTypeDescription
printerSettingsPrinterSettingsthe specified instance of the PrinterSettings class.
optionsPrintOptionsthe specified instance of the PrintOptions class.
documentNameStringthe document name to display (for example, in a print status dialog box or printer queue).

Examples

Shows how to use printer options, printer settings and document name to print the project.

var project = new Project(DataDir + "Project2.mpp");

var options = new PrintOptions
{
    Timescale = Timescale.Months
};

// Print first two pages
var settings = new PrinterSettings
{
    PrintRange = PrintRange.SomePages,
    FromPage = 1,
    ToPage = 2
};

project.Print(settings, options, "My project name");

See Also