Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

DIAPI print to pdf document


I am trying to print to pdf a invoice when I add it. Is there any way to do it by DIAPI?

Best Regards,

Ana Silva

Former Member

Hi Ana,

    Dim crReport As New ReportDocument

    If (File.Exists(ReportPath)) Then


      ' set parameters for your report

      crReport.SetParameterValue("@DocKey", "123")

      crReport.PrintOptions.PrinterName = ""

      crReport.DataSourceConnections(0).SetConnection(B1Connections.diCompany.Server, B1Connections.diCompany.CompanyDB, False)

      crReport.DataSourceConnections(0).SetLogon(B1Connections.diCompany.DbUserName, SqlServerPassword)

      crReport.PrintToPrinter(Copies, True, StartPage, EndPage)

    End If

Don't forget to include all necessary runtime dlls in the project. These are:



Also, you need to have the correct version of the runtime, installed in each client machine. I think SAP B1 installs CR runtime 12.x (not 100% sure).

If you add the dlls from any other version you must install that runtime version in the client machine.

CR versions and downloads:

I think you need the CR 2008.

Hope this helps,

Best regards,

Pedro Magueija

1 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question