Skip to Content

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

DIAPI print to pdf document

Hi,

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



Tags:
Former Member
replied

Hi Ana,

    Dim crReport As New ReportDocument

    If (File.Exists(ReportPath)) Then

      crReport.Load(ReportPath)

      ' 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:

CrystalDecisions.CrystalReports.Engine.dll

CrystalDecisions.Shared.dll

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:

http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=56787567

I think you need the CR 2008.

Hope this helps,

Best regards,

Pedro Magueija

1 View this answer in context

Helpful Answer

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