cancel
Showing results for 
Search instead for 
Did you mean: 

How to set Default Printer

ramco1917
Participant
124

Hi

  In below code is it possible to set default printer & path of Pdf file to be saved

oCmpSrv = oCompany.GetCompanyService();
oReportLayoutService = (ReportLayoutsService)oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.ReportLayoutsService);
oPrintParam = (ReportLayoutPrintParams)oReportLayoutService.GetDataInterface(SAPbobsCOM.ReportLayoutsServiceDataInterfaces.rlsdiReportLayoutPrintParams);
oPrintParam.LayoutCode = "INV20005";
oPrintParam.DocEntry = 34681;

oReportLayoutService.Print(oPrintParam);

Thanks

View Entire Topic
ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi ramco1917,

As DI API does not appear to have the Printer Setting functionality, there is a workaround that will require some manual work to set the desired printer in the layout (rpt) file itself.

These are the steps to apply the workaround:

  1. Export the layout from Report and Layout Manager saving it as an rpt file.
  2. Open the rpt file in Crystal Reports, change the printer in the File → Page Setup dialog and save the file.
  3. Import the rpt file in Report and Layout Manager.
  4. Repeat the steps above to each layout that will be sent via DI API to a non-default printer.

Kindly help to test the above mentioned steps and share whether it helps for your cause or not.

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

ramco1917
Participant
0 Kudos

Hi Ankit

    My requirement is when click on Custom Button Default Layout should be sent as an attachment to the Customer.

With the above code it asks for the file to be saved which i don't want.

Is there any other work around. If possible can u share some code.

Thanks