Spooler 2017

Retrieve printer information

// Copyright (c) 2018 ActivePDF, Inc.
// ActivePDF Spooler 2017
// Example generated 08/15/18 

using System;

// Make sure to add the ActivePDF product .NET DLL(s) to your application.
// .NET DLL(s) are typically found in the products 'bin' folder.

class Examples
{
  public static void Example()
  {
    Array arrayAvailableDPIs;
    Array arrayBinSources;
    bool isCollate;
    APSpoolerNET.ColorMode valColorMode;
    int valDPI;
    APSpoolerNET.DuplexMode valDuplex;
    Array arrayFormNames;
    APSpoolerNET.Orientation valOrientation;
    Array arrayPaperSizes;
    string valPrinterName;
    APSpoolerNET.TrueTypeOptions valTrueType;
    
    // Instantiate Object
    APSpoolerNET.Spooler oSP = new APSpoolerNET.Spooler();
    
    // Use the PrinterInfo object to retrieve current settings
    // and available options for the specified printer.
    APSpoolerNET.PrinterInfo oPI = oSP.PrinterInfo("Microsoft Print to PDF");
    
    arrayAvailableDPIs = oPI.AvailableDPI;
    arrayBinSources = oPI.BinSources;
    isCollate = oPI.Collate;
    valColorMode = oPI.ColorMode;
    valDPI = oPI.DPI;
    valDuplex = oPI.Duplex;
    arrayFormNames = oPI.FormNames;
    valOrientation = oPI.Orientation;
    arrayPaperSizes = oPI.PaperSizes;
    valPrinterName = oPI.PrinterName;
    valTrueType = oPI.TrueTypeOption;
    
    // Release Object
    oSP.Dispose();
    
    // Process Complete
    WriteResults("Done!");
  }
  
  // Write output data
  public static void WriteResults(string content)
  {
    // Choose where to write out results
  
    // Debug output
    //System.Diagnostics.Debug.WriteLine("ActivePDF: * " + content);
  
    // Console
    Console.WriteLine(content);
  
    // Log file
    //using (System.IO.TextWriter writer = new System.IO.StreamWriter(System.AppDomain.CurrentDomain.BaseDirectory + "application.log", true))
    //{
    //    writer.WriteLine("[" + DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + "]: => " + content);
    //}
  }
}

Copyright © 2018 ActivePDF, Inc