B4R Question How to open a new tab by viewing a pdf file using B4J as Web Server

Status
Not open for further replies.

Gabino A. de la Gala

Well-Known Member
Licensed User
Longtime User
I am using bj4 as a web server.
I have a web page with three buttons and every time I click on one of these buttons I launch the EjecutarTWP(params) process.

This process, what it does is to execute an external application using JShell that generates a pdf file with the desired results.

What I would like to achieve is that after generating the pdf file it will show it to me in an additional browser tab.

B4X:
Sub EjecutarTWP(Parametros As Map) As String
    Dim jsEjecutarTWP As Shell
    jsEjecutarTWP.Initialize("jsEjecutarTWP", FileRun, params)
    jsEjecutarTWP.WorkingDirectory = Main.settings.Get("PathMyrtusF")
    jsEjecutarTWP.Run(-1)
    Return Parametros.Get("FicheroDestino")
End Sub

Sub jsEjecutarTWP_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
    If Success And ExitCode = 0 Then
        Log("Success")
        Log(StdOut)
        Dim j As HttpJob
        j.Initialize("j", Me)
        j.PostString("http://127.0.0.1:51042/login_example/members/downloadpdf", "FicheroDestino=" & ParamsAux.Get("FicheroDestino") & "&CarpetaDestino=" & ParamsAux.Get("CarpetaDestino"))
        StartMessageLoop
    Else
        Log("Error: " & StdErr)
    End If
End Sub

Sub JobDone(j As HttpJob)
    If j.success Then
        Log(j.Success)       
    Else
        Log(j.errorMessage)
    End If
    j.Release
    StopMessageLoop
End Sub
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…