Using wPDFControl With PowerBuilder

  • Hi,
    I am trying the wPDFControl Demo with PowerBuilder 8.0. The application uses the ActiveX control.

    The code works OK, and does create a PDF. However, when I close the window, it abends with:

    pb80.exe - Application Error
    The instruction at "0x01cbd3e8" referenced memory at "0x00000728". The memory could not be "read".

    Then, PowerBuilder crashes.

    Using Visual Basic 6.0, and a translated program, there is no crash (on the same PC).

    Here is my code:

    Boolean lb_rc
    Long ll_lic_code,ll_hjpg
    String ls_lic_name='LicenseName',ls_lic_key='LicenseCode'

    lb_rc=ole_pdf.Object.StartEngine(is_pdf_dllname, "LicenseName", "LicenseCode",ll_lic_code)

    MessageBox('Start',lb_rc)

    IF lb_rc<> FALSE Then
    ole_PDF.Object.BeginDoc("c:\temp\atest3.pdf", 0)
    ole_PDF.Object.StartPage()
    ole_PDF.Object.Rectangle( 10, 10, 210, 100)
    ole_PDF.Object.TextOut( 50, 50, 'Hello there')
    // x,y,w,h,file
    ll_hjpg=ole_PDF.Object.DrawBitmapFile( 10, 300, 480, 532, 'c:\docs\docs\Palm Writing Guide.jpg')
    MessageBox('Draw JPG',ll_hjpg)
    // Return Value: 0=file not found.

    ole_PDF.Object.EndPage()
    ole_PDF.Object.EndDoc()
    ole_PDF.Object.StopEngine()
    End If

    What can I do?

    Thank you.

    • Offizieller Beitrag

    Hello!

    Does this always happen? The demo (only the demo does this) shows a nag screen at 2 times out of 3. If you start the application several times does this happen each time or only when the screen was actually displayed.

    I have no powerbuilder so I am unable to test it here, sorry.

    Julian Ziersch

  • Hi,
    Yes, it always happens. However, I have never seen a nag screen.

    Now, the message appears:

    wpCubed PDF Engine v2
    Demo is expired

    and the application closes, apparantly cleanly, but that was not the intent of the application.

  • Also, I found a workaround. The code was re-written to bypass the Active-X and use OLE instead:

    // This script works:

    Boolean lb_rc,lb_created
    Long ll_lic_code,ll_hjpg
    String ls_lic_name='LicenseName',ls_lic_key='LicenseCode'
    Int li_rc

    oleobject o_PDF

    o_PDF=CREATE oleobject
    li_rc=o_PDF.ConnectToNewObject('wPDF_X01.PDFControl')
    IF li_rc<>0 THEN
    MessageBox('Connect to wPDF'&
    ,'Connect to wPDF. Please install wPDF.',Exclamation!)
    RETURN -1
    END IF

    lb_created=TRUE

    lb_rc=o_pdf.StartEngine(is_pdf_dllname, "LicenseName", "LicenseCode",ll_lic_code)

    MessageBox('Start',lb_rc)

    IF lb_rc<> FALSE Then
    o_pdf.BeginDoc("c:\temp\atest6.pdf", 0)
    o_pdf.StartPage()
    o_pdf.Rectangle( 10, 10, 210, 100)
    o_pdf.TextOut( 50, 50, 'Hello THERE test 5!')
    // x,y,w,h,file
    ll_hjpg=o_pdf.DrawBitmapFile( 10, 300, 480, 532, 'c:\docs\docs\Palm Writing Guide.jpg')
    MessageBox('Draw JPG',ll_hjpg)
    // Return Value: 0=file not found.


    o_pdf.EndPage()
    o_pdf.EndDoc()
    o_pdf.StopEngine()
    End If

    IF IsValid(o_PDF) THEN
    IF lb_created THEN
    DESTROY o_PDF
    END IF
    END IF