|Printing NeoBook Information|
|Home - Tips & Trix|
Having problems printing information from NeoBook?
Printing the PUB Page isn't exactly what you had in mind...? You could type your variables into an RTF file, then (programmatically) create and print your own RTF file.
An RTF file is actually just an ASCII text file with instructions in it, (unformatted text, control words, control symbols, and groups), that tell a word processor how to reconstruct the text within the document.
Does that sound familiar? If you know anything about making web pages then you're probably saying "hey, that sounds like HTML". Well, it's close, but RTF code is not quite as easy on the eyes. To take a look at some RTF syntax, open WordPad and type-in some things. Make some things bold, some italic, underlined, etc. Save it as an RTF file, close WordPad, then open your test RTF file in Notepad. You'll notice that, for the mostpart, it is readable. At first glance it is not exactly as readable as HTML, but you'll get the idea.
By knowing the construct of an RTF file you can use the FileWrite command to create your own RTF files. With that, printing should be somewhat easier.
You might be thinking, "I have to learn all that gibberish just to print my own RTF file?!". The answer is, No. You could make your RTF file by creating the actual document the way you want it to look when printed. Place your [varaible_names] in the document wherever needed. This will serve as a sort of template for inserting information later.
In the illustration
above the "Bill Of Sale" template document already has NeoBook [Variable_Names]
in the appropriate places. Each variable will be replaced with real data
once the actual document is created.
Once you have created a template RTF document save it, then wrap each line of RTF code in NeoBook's FileWrite commands.
FileWrite "[PubDir]Print_Doc.RTF" "Append" "\par \plain\f4\fs20 [DateLong]"
By hand this can
be an extremely tedious job. The HTML Wrapper utility will come
in very handy for this task. What can take quite a long time to
do by-hand, the Wrapper will do for you in mere seconds! And, remember
the quotation problem described earlier? The HTML Wrapper program will
automatically replace all found double-quote characters with single-quotes
( ' ). This way the double-quote will not interfere with NeoBook's
expected script syntax.
Use the File Open button to select your RTF file. Since the Wrapper was made for HTML files, you'll need to force the open dialog box to display RTF files by typing "*.RTF" into the File name: box - then press Enter.
Tell the FileWrite command where to create the output RTF file and what filename to use. The illustration above is using the [PubDir] Global Variable followed by "Bill of Sale.RTF" as the filename. Checkmark Place on Clipboard and/or Open Text.
Press the Wrap button to begin. The Wrapper will begin processing the RTF file generating NeoBook code. When it has completed, (it only takes a few seconds), the resulting script should look something like this...
make a form in your NeoBook program that can take user input for the document.
Next, make a Print button in your publication and just Paste the FileWrite-RTF code into the Action Editor. Follow the FileWrite commands with the PrintTextFile command.
"1500" ... (allow time for file to close)
[ Return to NeoDezign Tips & Trix ]