Printing examples?

Dwayne Rothe drothe at optusnet.com.au
Thu Mar 31 19:49:07 EST 2005


Hi Graham,
I think RunRev is definately limited in it's print functions especially when
using win os.
I  have been trying to find a way to have the default Windows print preview
window appear from runrev.
Type res://C:\WINDOWS\System32\shdoclc.dll/preview.dlg into the address bar
of your webbrowser to
see the BLANK example. If we could some how find a way to load our projects
pages to it we would have
all the functions it offers like multiple page view, zoom-, zoom+, page
setup e.t.c

For now I am using a clumsy but effective way of giving the user a multiple
page preview(divides document into correct amount of pages for printing as
per papersize). This is acheived using XMLNS routine and a small HTA script.
Paste the code below into a text file and rename it print.hta copy it to
your windows TEMP folder.
You can find the exact path by using put specialFolderPath("Temporary") into
fld "field"

<HTML XMLNS:IE>
<HEAD>
<?IMPORT NAMESPACE="IE" IMPLEMENTATION="#default">
<STYLE TYPE="text/css">
.contentstyle
{
  width:6.3in;"sets preview width .75 scale"
  height:8.25in;"sets preview height .75 scale"
  margin:54pt;
  background:white;
  border:1 dashed gray;
}
.masterstyle
{
  width:8.5in;"sets printed page width"
  height:11in;"sets printed page height"
  background:#FFFF99;
  border-left:1 solid black;
  border-top:1 solid black;
  border-right:4 solid black;
  border-bottom:4 solid black;
  margin:10px;
}
</STYLE>
<HTA:APPLICATION ID="oMyApp"
    APPLICATIONNAME="Print Preview"
    BORDER="thin"
    CAPTION="yes"
    ICON="/graphics/creature.ico"
    SHOWINTASKBAR="no"
    SINGLEINSTANCE="yes"
    SYSMENU="yes"
    WINDOWSTATE="maximize"
</HEAD>

<BODY>
<IE:DEVICERECT ID="page1" CLASS="masterstyle" MEDIA="print">
 <IE:LAYOUTRECT ID="layoutrect1" CONTENTSRC="temp.html" CLASS="contentstyle"
NEXTRECT="layoutrect2"/>
</IE:DEVICERECT>

<IE:DEVICERECT ID="page2" CLASS="masterstyle" MEDIA="print">
 <IE:LAYOUTRECT ID="layoutrect2" CLASS="contentstyle"/>
</IE:DEVICERECT>

</BODY>
</HTML>

When using a preview page in your application, generate the projects page as
HTML and save it as temp.html to your windows temp folder in the same folder
as print.hta, now run print.hta using the following code:

put specialFolderPath("Temporary") into appTempFolder
if "NT" is in the systemVersion then set shellCommand to "cmd.exe"
else set shellCommand to "command.exe"
set hideConsoleWindows to true
get shell("start" && appTempFolder & "/print.hta")

Print.hta will look for and load temp.html into itself, temp.html will be
overwritten each time you preview, this way you won't overtime be adding
tons of pages to the temp folder!

Hope this helps Cheers Dwayne Rothe.....

> ------------------------------
>
> Message: 10
> Date: Thu, 31 Mar 2005 15:15:19 +0200
> From: graham samuel <graham.samuel at wanadoo.fr>
> Subject: Printing examples?
>
> Folks, it's a long time since I've tried to develop a printing routine
> in RunRev and I find I want to do quite simple stuff that I would
> imagine other people have done dozens or even hundreds of times, which
> is to print a field of indefinite length on however many pages it takes
> to print it on, respecting the preset paper size and print margins and
> adding in stuff like page numbers and maybe running headers. I see that
> it is all possible (apart from my long-standing gripe that a RunRev
> script can't know the actual size of the available printable area on
> any specific printer) but I am surprised to say the least that I have
> to reinvent the wheel in this way.
>
> Would anyone be kind enough to point me at a reasonably simple
> multi-page print routine? I couldn't find one in the published
> examples, apart from Hugh Senior's PrintA4 from his Scripter's
> Scrapbook, which I'm looking at now (thanks Hugh) but it doesn't do
> exactly what I was expecting.
>
> While I'm asking for help with printing, can anyone explain what I do
> to get a print dialog (not the page setup dialog) to come up on a PC?
> According to the RunRev documentation:
>
> > The open printing with dialog form opens the print dialog box on Mac
> > OS systems. On Unix or Windows systems, this form acts like the open
> > printing form, and no dialog box appears. If the as sheet form is
> > used, the dialog box appears as a sheet on OS X systems.
>
> Well, I would like a dialog box to appear, as it does on all mainstream
> PC apps including Microsoft's own, so how is it done (I should say I'm
> developing on a Mac at the moment, and a quick trip to my XP machine
> does confirm this; but if anyone has the answer it would save further
> experimentation)?
>
> TIA
>
> Graham
===================================================



More information about the use-livecode mailing list