Below is the X++ code to print sales invoice on printer directly.
Args salesArgs = new Args();
SalesInvoiceContract salesInvoiceContract;
SalesInvoiceController controller;
SrsReportRunImpl srsReportRunImpl;
str fileName;
CustInvoiceJour custInvoiceJour;// = _args.record();
select custInvoiceJour where custInvoiceJour.InvoiceId=="INV_00000009";
salesArgs.record(custInvoiceJour);
controller = new SrsReportRunController();
salesInvoiceContract = new SalesInvoiceContract();
controller.parmReportName(ssrsReportStr(SalesInvoice,Report));
controller.parmShowDialog(false);
controller.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::Printer);
// controller.parmReportContract().parmPrintSettings().printerName(@"\\espprn03\Follow Me - MFP");
salesInvoiceContract.parmRecordId(custInvoiceJour.RecId); // Record id must be passed otherwise the report will be empty
salesInvoiceContract.parmCountryRegionISOCode(SysCountryRegionCode::countryInfo()); // comment this code if tested in pre release
controller.parmReportContract().parmRdpContract(salesInvoiceContract);
controller.startOperation();