Thanks Jan.
Here is the code I came up with. I want a half inch (36 pixels) margin
on all sides.
case "Print Window..."
if the printPaperOrientation = "portrait" then
put item 1 of printPaperSize - 36 into vX -- 36 = 0.5
inch margin should be supported on all printers
put item 2 of printPaperSize - 36 into vY
else
put item 1 of printPaperSize - 36 into vY -- 36 = 0.5
inch margin should be supported on all printers
put item 2 of printPaperSize - 36 into vX
end if
answer printer as sheet
if the result is not "Cancel" then
if (the width of this stack > vX) or (the height of this
stack > vY) then -- window bigger than paper
if (item 4 of the rect of this card / vY) > (item 3 of
the rect of this card / vX) then -- which ratio will be limiting
set the printScale to (vY - 36) / item 4 of the
rect of this card
else
set the printScale to (vX - 36) / item 3 of the
rect of this card
end if
else
set the printScale to 1
end if
set the printMargins to 36,36,36,36 -- 0.5 inch margin
print this card
end if
break
The resulting printout includes the menu items above the window (on a
Mac - not tested on Windows). How do I prevent it?
Bill Vlahos
On Nov 10, 2008, at 11:59 PM, Jan Schenkel wrote:
When you use this 'print into rect' approach,
Revolution ignores the 'printScale' property; so if
you want to 'print into rect' with scaling to ensure
that everything fits while preserving a relative size,
you'll need to tweak your paper rectangle a bit.
Continuing with the above example of a rectangular
area on your card, you would have something like:
(mind the line wrappings)
##
on mouseUp
answer printer as sheet
if the result is "Cancel" then exit mouseUp
set the printerOutput to "preview"
put the topleft of graphic "PrintRect" into
theTopLeft
put the bottomRight of graphic "PrintRect" into
theBottomRight
put "30,100,500,700" into thePaperRect
-- now we calculate how we can save the relative
size
put item 1 of theBottomRight - item 1 of theTopLeft
\
into theOriginWidth
put item 2 of theBottomRight - item 2 of theTopLeft
into \
theOriginHeight
put item 3 of thePaperRect - item 1 of thePaperRect
into \
thePrintWidth
put item 4 of thePaperRect - item 2 of thePaperRect
into \
thePrintHeight
put thePrintWidth / theOriginWidth into
theWidthRatio
put thePrintHeight / theOriginHeight into
theHeightRatio
if theWidthRatio > theHeightRatio then
put round(theOriginWidth * theHeightRatio) into
thePrintWidth
else if theWidthRatio < theHeightRatio then
put round(theOriginHeight * theWidthRatio) into
thePrintHeight
end if
put item 1 of thePaperRect + thePrintWidth into \
item 3 of thePaperRect
put item 2 of thePaperRect + thePrintHeight into \
item 4 of thePaperRect
print this card from theTopLeft to theBottomRight
into thePaperRect
end mouseUp
##
HTH,
Jan Schenkel.
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution