|
Flex¤Ç¥³¡¼¥Ç¥£¥ó¥°¤·¤Æ¤¤¤ë¤È¤¤Ë¡¢²èÌ̤ò¥×¥ê¥ó¥È¥¢¥¦¥È¤Ç¤¤ëɬÍפ¬È¯À¸¤¹¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£
¤½¤³¤Ç¡¢É½¼¨¤µ¤ì¤Æ¤¤¤ë¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ò¥×¥ê¥ó¥È¥¢¥¦¥È¤¹¤ë¤È¤¤ËÍÍѤʤΤ¬FlexPrintJob¤Ç¤¹¡£
¤·¤«¤·¡¢¥³¥ó¥Ý¡¼¥Í¥ó¥È¤´¤È¤Î°õºþ¤Ë¤Ê¤ë¤Î¤Ç¡¢Ê£¿ô¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ò°ìËç¤Î»æ¤Ë°õºþ¤·¤è¤¦¤È¤¹¤ë¤È¡¢
¤¦¤Þ¤¯¤¤¤¤Þ¤»¤ó¤Ç¤·¤¿¡£
¤½¤¦¤¤¤¦»þ¤Ï¡¢°õºþÍѤΥ³¥ó¥Ý¡¼¥Í¥ó¥È¤òaddChild,removeChild¤¹¤ì¤ÐÎɤ¤¤è¤¦¤Ç¤¹¡£
¡ã!--°õºþÍѤΥ³¥ó¥Ý¡¼¥Í¥ó¥È¡ÊXAML¦¡Ë²¾¤Ë¥³¥ó¥Ý¡¼¥Í¥ó¥È̾¤Ï¡ÖPrintView¡×¤È¤·¤Þ¤¹-->
<?xml version="1.0"?>
<mx:VBox
¡¡¡¡xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="*"
backgroundColor="#FFFFFF"
paddingTop="40"
paddingBottom="20"
paddingLeft="40"
paddingRight="40"
horizontalScrollPolicy="off"
xmlns:com="jp.kaun.wedding.essential.question.ui.com.*">
<com:PrintTitle width="100%" id="printTitle"/>
<mx:Canvas width="100%"
height="100%"
horizontalScrollPolicy="off">
<mx:VBox height="100%"
width="100%"
horizontalAlign="center"
id="mainFrame"
horizontalScrollPolicy="off"/>
</mx:Canvas>
<mx:Spacer height="20"/>
<com:PrintFooter width="100%" id="printFooter"/>
</mx:VBox>
<!--printTitle¤ÎÃæ¿È-->
<?xml version="1.0"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%"
horizontalAlign="center" >
<mx:Label text="{title}" styleName="title"/>
<mx:Spacer width="20"/>
<mx:Label text="{subTitle}" styleName="subTitle"/>
<mx:Spacer width="20"/>
<mx:Script>
<![CDATA[
[Bindable]
public var title:String = "";
[Bindable]
public var subTitle:String = "";
]]>
</mx:Script>
</mx:VBox>
<!--printFooter¤ÎÃæ¿È-->
<?xml version="1.0"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%">
<mx:Script>
<![CDATA[
import jp.kaun.wedding.WeddingFlexConst;
import jp.kaun.wedding.common.util.CustomFormat;
[Bindable]
public var company:String = "";
[Bindable]
public var totalPage:String = "";
[Bindable]
public var date:Date = new Date();
]]>
</mx:Script>
<mx:Label text="{company}" width="{this.width/3.3}"/>
<mx:Label text="{totalPage}" textAlign="center" width="{this.width/3}"/>
<mx:Label text="{CustomFormat.formatForReportDate(date, WeddingFlexConst.FORMAT_SHORT_DATE)}" textAlign="right" width="{this.width/3}"/>
</mx:HBox>
¤Ê¤ª¡¢printTitle¤ÈprintFooter¤Ï¥é¥Ù¥ë¤Ë¤·¤Æ¡¢printView¤Ç¥Ð¥¤¥ó¥É¤·¤Æ¤âÌäÂꤢ¤ê¤Þ¤»¤ó¡£
ºÇ¸å¤Ë¥¯¥é¥¤¥¢¥ó¥È¦¡ÊJavaScript¡Ë¤ÎÃæ¿È¤Ç¤¹¡£
private var display:printCanvas;
public function initialized(showDisplay :Object,id:String):void
{
display= showDisplay as printCanvas;
}
public function btnPrint(event:Event):void {
//º£²ó¤Ïdisplay¤È¤¤¤¦²èÌ̤ò°õºþ¤·¤¿¤¤¤È²¾Äꤷ¤Þ¤¹¡£
var display:showDisplay = this;
¡¡¡¡var pj:FlexPrintJob = new FlexPrintJob();
¡¡¡¡var reportDate:Date = new Date();
¡¡¡¡// °õºþ½èÍý¤ò¼Â¹Ô¤¹¤ë
if(pj.start()) {
var thePrintView:PrintView = new PrintView();
¡¡¡¡¡¡¡¡//¤³¤³¤ÏǤ°Õ¤ÎÂ礤µ¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤¡£
var pageHeight:Number = 1300;
var pageWidth:Number = 1800;
//ɽ¼¨²èÌ̤˰õºþÍÑ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ò²Ã¤¨¤ë¡£
display.addChild(thePrintView);
thePrintView.validateNow();
display.validateNow();
//°õºþ²èÌ̤Υµ¥¤¥º¤òÀßÄꤹ¤ë
thePrintView.width= pageWidth;
thePrintView.height=pageHeight;
//°õºþ²èÌ̤Υ¿¥¤¥È¥ë¤È¥µ¥Ö¥¿¥¤¥È¥ë¤ò¥»¥Ã¥È¤¹¤ë
thePrintView.printTitle.title = "DisplayTest";
thePrintView.printTitle.subTitle = "SubTitle";
//°õºþ²èÌ̤ÎFooter¤ò¥»¥Ã¥È¤¹¤ë
thePrintView.printFooter.company = "TestCompany";
thePrintView.printFooter.date = reportDate;
//°õºþ²èÌ̤˰õºþ¤·¤¿¤¤¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òÄɲ乤ë
var canvas:TablePlanCanvas = display;
thePrintView.mainFrame.addChild(canvas.showComponet);
pj.printAsBitmap = false;
¡¡¡¡¡¡¡¡//SHOW_ALL¤Ë¤¹¤ë¤È°ìËç¤Ë¼ý¤Þ¤ë
pj.addObject(thePrintView, FlexPrintJobScaleType.SHOW_ALL);
¡¡¡¡¡¡¡¡//thePrintView.mainFrame¤Ëadd¤·¤¿¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ò¸µ¤Î¾ì½ê¤ËÌ᤹¡£
¡¡¡¡¡¡¡¡//¿Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ë¤¤Á¤ó¤ÈÌᤷ¤Æ¤¯¤À¤µ¤¤
display.parentContainer.addChild(canvas.showComponet);
//°õºþ²èÌ̤òºï½ü¤¹¤ë
display.removeChild(thePrintView);
//¥×¥ê¥ó¥¿¤Þ¤Ç¥Ç¡¼¥¿¤òÁ÷¤ê¤Þ¤¹
pj.send();
}
}
¤³¤Î¤è¤¦¤Ê·Á¤Ë¤Ê¤ê¤Þ¤¹¡£
|