all groups > flash actionscript > december 2004 >
You're in the

flash actionscript

group:

PrintJob center content on printed page?


PrintJob center content on printed page? TinMonkey
12/17/2004 8:27:09 PM
flash actionscript:
Does anyone know how to specify the printed contents position on printed page.
I would like the content I am printing ot center on the page so that the
border is even all around. I can't even seem to do it in my printer dialog box.
no option for centering in driver. Any one have any Ideas?
Re: PrintJob center content on printed page? TinMonkey
12/19/2004 4:35:53 AM
Re: PrintJob center content on printed page? Retroboy_mx
12/19/2004 11:07:29 AM
Hi Flasher!!!<br><br>Hope this Help you,

function printPage(){

var myPrintJob:PrintJob=new PrintJob();
var result:Boolean=myPrintJob.start();
if(result){


myPrintJob.addPage(0,{xMin:xMin,xMax,yMin:yMin,yMax:yMax},{printAsBitmap:true,_c
urrentframe);
myPrintJob.send()
}

}
Re: PrintJob center content on printed page? TinMonkey
12/19/2004 7:12:06 PM
Hey, thanks for the reply...
I dont think I explained my problem good enough. I know how to use the
printJob class as you described, and it works. The content prints correctly and
the correct size, the problem is that it does not center on the page. I am
tryting to find out if there is a modifier to this class that will tell the
content to center on page instead of default to upper left. If the code you
posted does force center, please explain how. the code I am using now looks
like this...


_root.print_btn.onRelease = function()
{
var pageCount:Number = 0;

var my_pj:PrintJob = new PrintJob();

if (my_pj.start())
{
if (my_pj.addPage(0, {xMin:18,xMax:595,yMin:18,yMax:775},
{printAsBitmap:false}, 5)){
pageCount++;
if (pageCount > 0){
my_pj.send();
}
}
}
delete my_pj;
}
Re: PrintJob center content on printed page? Trus Joist
5/30/2006 8:47:57 PM
This is as close to centered as I can get. When you create your movieclip, you
need to set the orientation of the clip itself to "center".

btnPrint.onRelease = function() {
var pj = new PrintJob();
var success = pj.start();
if (success) {
//Centered Variables
var xHalfMax:Number = pj.pageWidth/2;
var yHalfMax:Number = pj.pageHeight/2;
var xHalfMin:Number = xHalfMax*-1;
var yHalfMin:Number = yHalfMax*-1;
pj.addPage("instance_mc", {xMin:xHalfMin, xMax:xHalfMax, yMin:yHalfMin,
yMax:yHalfMax});
pj.send();
}
delete pj;
};
AddThis Social Bookmark Button