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

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Googie85
Posts: 227
Joined: Tue Aug 05, 2014 10:07 am

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

Post by Googie85 » Thu Oct 16, 2014 9:57 am

Is it possible to print an .rtf file with livecode?

Many Thanks,

Matthew.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

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

Post by Klaus » Thu Oct 16, 2014 4:07 pm

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

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

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

Post by [-hh] » Thu Oct 16, 2014 6:06 pm

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
shiftLock happens

Post Reply