Styled text printing

I made a web page on styled text printing on Linux:

The link seems to be broken.

http://linux-xojo.eu.pn should work

It doesn’t.

have found it here

http://www.tsx.nl/xojo/printingstyledtext.html

here an example for printing Xojo TexArea with Ted

Download

Since almost all linux distributions have libre office installed, we can use it to print StyledText on Linux.

Print

Public Sub printRTFwithLibre(source as textarea)
  dim sh as new shell
  dim cmd as String
  dim tmp as FolderItem = SpecialFolder.Temporary.Child("myRTF.rtf")
  dim bs as BinaryStream = BinaryStream.Create(tmp, true)
  bs.Write(source.StyledText.RTFData)
  bs.Close
  cmd = "libreoffice  --writer -p --headless " + tmp.ShellPath
  sh.Execute(cmd)
End Sub

PDF

Public Sub showPDFwithLibre(source as textarea)
  dim sh as new shell
  dim cmd as String
  dim tmp as FolderItem = SpecialFolder.Temporary.Child("preview.rtf")
  dim bs as BinaryStream = BinaryStream.Create(tmp, true)
  bs.Write(source.StyledText.RTFData)
  bs.Close
  cmd = "cd /tmp;libreoffice --convert-to pdf:writer_pdf_Export --headless " _
  + tmp.ShellPath
  sh.Execute(cmd)
  if tmp <> nil and tmp.Exists then
    dim pdf As FolderItem = SpecialFolder.Temporary.Child("preview.pdf")
    if pdf <> nil and pdf.Exists then
      ShowURL(pdf.URLPath)
    end if
  end if
End Sub