Flex打印功能,可以采用其自身带的PrintJob类,当然这个比较简单也没有预览功能
(1)利用自带的PrintJob
public function doPrint():void
{
var printJob:PrintJob = new PrintJob();
if (printJob.start())
{
this.width=printJob.pageWidth;
this.height=printJob.pageHeight;
var rent:Rectangle=new Rectangle();//打印范围
rent.x=120;
rent.y=30;
rent.height=700;
rent.width=1000;
var prj:PrintJobOptions=new PrintJobOptions();
prj.printAsBitmap=true;
this. canLeft.scaleX=0.6;
this.canLeft.scaleY =1;
printJob.addPage(this.canLeft,rent,prj);
printJob.send();
this.canLeft.scaleX=1;
this.canLeft.scaleY =1;
this.percentHeight=100;
this.percentWidth=100;
}
}
canLeft为打印的容器
(1)利用自带的PrintJob
public function doPrint():void
{
var printJob:PrintJob = new PrintJob();
if (printJob.start())
{
this.width=printJob.pageWidth;
this.height=printJob.pageHeight;
var rent:Rectangle=new Rectangle();//打印范围
rent.x=120;
rent.y=30;
rent.height=700;
rent.width=1000;
var prj:PrintJobOptions=new PrintJobOptions();
prj.printAsBitmap=true;
this. canLeft.scaleX=0.6;
this.canLeft.scaleY =1;
printJob.addPage(this.canLeft,rent,prj);
printJob.send();
this.canLeft.scaleX=1;
this.canLeft.scaleY =1;
this.percentHeight=100;
this.percentWidth=100;
}
}
canLeft为打印的容器