#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private HTMLEditor1 As HTMLEditor
Private temp As JavaObject
'***
'HTMLEditor1 when Enter is pressed, it is a new paragraph and it inserts a line.
'***
Private Button1 As Button
Private btnPrint As Button
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.SetFormStyle("UNIFIED")
MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
Dim INITIAL_TEXT As String
INITIAL_TEXT = $"<html><body>Lorem ipsum dolor sit
amet, consectetur adipiscing elit. Nam tortor felis, pulvinar
in scelerisque cursus, pulvinar at ante. Nulla consequat
congue lectus in sodales. Nullam eu est a felis ornare
bibendum et nec tellus.
<br /> <b>
Vivamus non metus tempus augue auctor
ornare. Duis pulvinar justo ac purus adipiscing pulvinar.
Integer congue faucibus dapibus. Integer id nisl ut elit
aliquam sagittis gravida eu dolor. Etiam sit amet ipsum
SEE APOSTROPHE ' </b>
<br />
Special Notes: $Date{DateTime.now} </body></html>"$
HTMLEditor1.HtmlText=INITIAL_TEXT
MainForm.Show
End Sub
Sub btnPrint_Action
Dim js As Shell
Dim params As List
params.Initialize
'save the text to a file. New lines characters are replaced with <br/>.
File.WriteString(File.DirApp,"TestHTML.htm",HTMLEditor1.HtmlText)
Log("1")
params.Add("printername=" & HTMLEditor1.HtmlText) '.Replace("'","*"))
params.Add("file=TestHTML.htm")
js.Initialize("js", "printhtml.exe", params)
js.WorkingDirectory = File.DirApp
js.Run(-1) 'run with no timeout
Log("2")
btnPrint.Enabled = False
End Sub
Sub js_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log("Success=" & Success & ", StdOut=" & StdOut & ", StdErr=" & StdErr)
btnPrint.Enabled = True
End Sub