Skip to Content

How to export layout to pdf using sdk

Hi.

How can we save an invoice or any other layout to pdf using sdk? The document is already saved.

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Sep 04, 2017 at 05:47 AM

    Hi Fedias,

    The print layout system in B1 is limited to the client software. it is only accessible through the SDK via the UI API.

    That means that you can try to manipulate a print layout by using the UI API to press the right buttons and menus, and/or opening the related form. In other words, use the UI API to replicate whatever a user would do.

    It would probably be easier to create your own pdf creator class. There are several .net libraries out there, like Expert Pdf Components, or Essential Objects. I also hear good things about Sharpshooter.

    Regards,

    Johan

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 13, 2017 at 12:36 PM

    Hi Johan,

    Thanks for your response.

    We want to avoid use the crystal reports libraries to prepare the pdf, that's why we are looking somehow to directly export it and then use it as attachment.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Fedias,

      The libraries I mentioned above are in no way related to Crystal Reports. They are independent from SAP, and can be used in any .NET (C# or VB.NET) application.

      The UI API is related only to the B1 client, so also not to Crystal reports. The UI API is the only way to access the print layout system in the B1 client.

      Regards,

      Johan

  • Sep 14, 2017 at 01:00 PM

    Hi Fedias,

    This should help you

    http://www.b1tech.tips/2016/01/printing-system-layout-in-sap-business.html

    So if you have a PDF printer set as default would work. I don`t think it is the perfect solution but is at least a workaround.

           SAPbobsCOM.CompanyService oCmpSrv;
           SAPbobsCOM.ReportLayoutsService oReportLayoutService;
           SAPbobsCOM.ReportLayoutPrintParams oPrintParam;
           oCmpSrv = oCompany.GetCompanyService();
           oReportLayoutService = (ReportLayoutsService)oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.ReportLayoutsService);
           oPrintParam = (ReportLayoutPrintParams)oReportLayoutService.GetDataInterface(SAPbobsCOM.ReportLayoutsServiceDataInterfaces.rlsdiReportLayoutPrintParams);
           oPrintParam.LayoutCode = "INV20014";
           oPrintParam.DocEntry = 350;
           oReportLayoutService.Print(oPrintParam);
    Add comment
    10|10000 characters needed characters exceeded