Print Pdf through Axapta


Description:-

In this Article we will see how to print Pdf file through code. Here is the demo Example to Understand how it’s works.

Code:-

static void printpdf(Args _args)
{
    PrintJobSettings    printJobSettings = new PrintJobSettings();
    Dialog              dialog = new Dialog();
    DialogField         dialogFileName;
    str                 adobeExe;
    str                 adobeParm;
    ;
    dialogFilename  = dialog.addField(extendedTypeStr(FilenameOpen));

    if (dialog.run())
    {    
        printJobSettings.printerSettings('SysPrintForm');    
        adobeExe = WinAPI::findExecutable(dialogFileName.value());

        adobeParm = strFmt(' /t "%1" "%2" "%3" "%4"',
                           dialogFileName.value(),
                           printJobSettings.printerPrinterName(),
                           printJobSettings.printerDriverName(),
                           printJobSettings.printerPortName());
        winAPI::shellExecute(adobeExe,  adobeParm);
    }
}

Related Posts

Previous
Next Post »

Thanks for comments.....