Hello everyone
I am creating a pdf file in a Handle(JRDC2) using PowerShellConvertToPdf
Ok, so far so good. The pdf file is created
But on the server, PowerShellConvertToPdf takes about 3 seconds to create the pdf file.
So I understand that when B4A receives in j.GetString "<Pdf Created>", in reality the file does not yet exist on the server.
What I need?
Validate that the pdf file has been created successfully
What have I tried to do?
Result in B4A:
Log("<" & j.GetString & ">") => "<>"
Result in B4A:
Log("<" & j.GetString & ">") => "<>"
How can I validate in the Handle that the pdf file was created successfully, so that B4A receives "Pdf Created"?
I appreciate any ideas or suggestions.
I am creating a pdf file in a Handle(JRDC2) using PowerShellConvertToPdf
PostString is sent from B4A:
Dim j As HttpJob
j.Initialize("", Me)
j.PostString(link,dataToPdf)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log("<" & j.GetString & ">")
End If
In the Handle(req As ServletRequest, resp As ServletResponse):
try
WD.PowerShellConvertToPdf(FileIn,FileOut, False)
resp.Write("Created PDF")
catch
Log(LastException)
resp.Write("Not Created PDF")
End Try
Ok, so far so good. The pdf file is created
B4A immediately shows::
Log("<" & j.GetString & ">") => "<Created PDF>"
But on the server, PowerShellConvertToPdf takes about 3 seconds to create the pdf file.
So I understand that when B4A receives in j.GetString "<Pdf Created>", in reality the file does not yet exist on the server.
What I need?
Validate that the pdf file has been created successfully
What have I tried to do?
Use Wait for:
'I changed this:
WD.PowerShellConvertToPdf(FileIn,FileOut, False)
resp.Write("Created PDF")
'For this
Wait For (WD.PowerShellConvertToPdf(FileIn,FileOut, False)) Complete (Success As Boolean)
If Success Then
resp.Write("Pdf Creado")
Else
resp.Write("Pdf No Creado")
End If
Result in B4A:
Log("<" & j.GetString & ">") => "<>"
Second try::
WD.PowerShellConvertToPdf(FileIn,FileOut, False)
Dim exists As Boolean = False
Do While exists = False
If File.Exists(dir, name) Then
exists = True
Log("already created")
Else
Sleep(400)
Log("wait")
End If
Loop
resp.Write("Created PDF")
Result in B4A:
Log("<" & j.GetString & ">") => "<>"
How can I validate in the Handle that the pdf file was created successfully, so that B4A receives "Pdf Created"?
I appreciate any ideas or suggestions.