[Laszlo-user] View/clip size mismatch and printing

Michael Pliskin pl at tepkom.ru
Tue Mar 7 11:54:00 EST 2006

Hello graphis1,

This is the exact code fragment which prints out the view. Note the
'printScale' method that does exactly what you are describing... the
problem is that is does not help :( because we're printing the MC, not
view, and MC is _always_ of different size than view no matter how you
scale any of them.

               <method name="addPage" args="theView"><![CDATA[
                        var scale = getPrintScale(theView);
                        var mc = theView.getMCRef();

                        var width = theView.width;
                        var height = theView.height;

                        var x = mc._x;
                        var y = mc._y;
                        var xs = mc._xscale;
                        var ys = mc._yscale;
                        mc._x = 0;
                        mc._y = 0;
                        mc._xscale = mc._xscale * scale;
                        mc._yscale = mc._yscale * scale;
                        this.job.addPage(mc, {xMin: 0, yMin: 0, xMax:theView.width, yMax: theView.height}, null};
                        mc._xscale = xs;
                        mc._yscale = ys;
                        mc._x = x;
                        mc._y = y;

                <method name="getPrintScale" args="theView, wide, tall"><![CDATA[
                        var xscale = job.pageWidth * wide / theView.width;
                        var yscale = job.pageHeight * tall / theView.height;
                        return xscale < yscale ? xscale : yscale;

>>  We scale the view beforehand according to the pagesize and when we
>>  print, it works fine except for the page being cropped in the bottom
>>  for some reason.

gmc> Could you scale the view proportionally dependent upon the height and not the width?

gmc> i.e. 
gmc> 1) Scale the y value of the view to match the y value of the pagesize.
gmc> 2) Resize the x value using the same rescale proportion as above.

gmc> The would result in a view that's rescaled to fit the page
gmc> instead of one that's cropped to fit the page.

Best regards,
 Michael                            mailto:pl at tepkom.ru

More information about the Laszlo-user mailing list