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

Discussion in 'B4R Questions' started by Gabino A. de la Gala, Nov 5, 2019.

Thread Status:
Not open for further replies.
  1. Gabino A. de la Gala

    Gabino A. de la Gala Active Member Licensed 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.

    Code:
    Sub EjecutarTWP(Parametros As MapAs 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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread in B4J forum.
     
Thread Status:
Not open for further replies.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice