Page 1 of 1

Printing a .rtf (Rich-Text Format) File.

Posted: Thu Oct 16, 2014 9:57 am
by Googie85
Is it possible to print an .rtf file with livecode?

Many Thanks,

Matthew.

Re: Printing a .rtf (Rich-Text Format) File.

Posted: Thu Oct 16, 2014 4:07 pm
by Klaus
Hi Matthew,

well, printing EXTERNAL files is not directly possible in Livecode! 8)
But you can import that file into a field and then use "revprintfield" or something IN Livecode.


Best

Klaus

Re: Printing a .rtf (Rich-Text Format) File.

Posted: Thu Oct 16, 2014 6:06 pm
by [-hh]
Matthew,

because Klaus has a "short day" today (what is rather seldom) here a translation of "or something IN Livecode".

You could try the following (example file path).
This "converts" your RTF to HTML and, if you wish, to a printable PDF.

Code: Select all

on mouseUp
  put "/Users/admin/Documents/Bittelesen.rtf" into myUrl
   If there is no fld "rtf2html" then create fld "rtf2html"
  -- hide fld "rtf2html"
  set rtftext of fld "rtf2html" to url ("file:"&myUrl)
  -- stop here if you wish to edit the imported text
  wait 10 millisecs with messages
  -- revShowPrintDialog true,true -- shows pageSetup and printDialog
  revShowPrintDialog false,true -- shows only printDialog
  -- in the second dialog you can choose "print to PDF" of your OS # <--
  revPrintText the htmltext of fld "rtf2html"
end mouseUp