Wednesday, June 17, 2015

How to get Paper sizes in AX 2012

static void Job1(Args _args)
{
    System.Drawing.Printing.PrinterSettings printSetting = new System.Drawing.Printing.PrinterSettings();
    System.Drawing.Printing.PaperSize  size = new System.Drawing.Printing.PaperSize();
    System.Collections.ArrayList    paperSizes;
    System.Collections.IEnumerator  enumerator;

    paperSizes= printSetting.get_PaperSizes();
    enumerator = paperSizes.GetEnumerator();

    while (enumerator.MoveNext())
    {
        size = enumerator.get_Current();
        info(size.get_PaperName());   
    }

}