> On 21 Mar 2015, at 18:17, J. Landman Gay <jac...@hyperactivesw.com> wrote:
> 
> So your printer has a print area of 8,8,834,587


I have just identified an issue.

On my first pass through the routines the printPaperRectangle = 18,18,801,577 
and the chart is offset to the left.

On my second and subsequent passes through the routines printPaperRectangle = 
8,8,834,587 and the chart is entered correctly.

Why would printPaperRectangle not be 8,8,834,587 after I set the pagesetup to 
landscape on the first pass?

Firstly from a button I do this:

   answer page setup as sheet
   if the result = "cancel" then
      exit mouseUp
   end if
   answer printer as sheet
   if the result = "cancel" then
      exit mouseUp
   end if
   send "printChart" to group  “generalChart"


Then my print routine:

on printChart

   put 10 into tLeftMargin
   put 10 into tRightMargin
   put 10 into tTopMargin
   put 10 into tBottomMargin
   
   put the printPaperRectangle into tPaperRect
   
   put tPaperRect
   
   put item 1 of tPaperRect into tPaperLeft
   put item 2 of tPaperRect into tPaperTop
   put item 3 of tPaperRect into tPaperWidth
   put item 4 of tPaperRect into tPaperHeight
   
   put tPaperWidth - tLeftMargin - tRightMargin into tAvailWidth
   put tPaperHeight - tTopMargin - tBottomMargin into tAvailHeight
   
   put the width of me into tChartWidth
   put the height of me into tChartHeight
   put tAvailWidth/tChartWidth into tWidthRatio   
   put tAvailHeight/tChartHeight into tHeightRatio   
   put min(tWidthRatio,tHeightRatio) into tRatio
   
   put tRatio * tChartWidth into tActualWidth
   put tRatio * tChartHeight into tActualHeight
   
   put (tPaperWidth - tActualWidth)/2 into tLM
   --put (tPaperHeight - tActualHeight)/2 into tTM -- this centres chart 
vertically on the page
   put tTopMargin into tTM -- this keeps the chart at the top of the page
   
   put tPaperLeft/2 into tOffsetH
   put tPaperTop/2 into tOffsetV
   
   set the printMargins to tLM + tOffsetH,tTM + tOffsetV,tLM - tOffsetH,tTM - 
tOffsetV
   
   set the printScale to tRatio
   
   --put "chart width = " & tW & return & "printPaperRectangle = " & tPaperRect 
& return & "printMargins = " & the printMargins
   
   put the topLeft of me into tTopLeft
   put the bottomRight of me into tBottomRight
   
   print card from tTopLeft to tBottomRight
   
end printChart
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to