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?
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() } }
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; }
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; };
Don't see what you're looking for? Try a search.
|