MyReportto PDF的代码示例
//外部方式向ReportViewer.Instance添加自定义PDF导出按钮
privatefunctionInitCustomButtons():void
{
varexportPDF:ToolButton = newToolButton();
exportPDF.width = 23;
exportPDF.setStyle("icon",Asset.ICON_FILE_PDF16);
exportPDF.toolTip ="导出PDF";
exportPDF.addEventListener(MouseEvent.CLICK,OnExportPDF);
ReportViewer.Instance.CustomToolBar.addChild(exportPDF);
}
处理导出PDF代码
functionOnExportPDF(e:MouseEvent):void
{
trace(导出PDF");
varpages:Array = myreport.ReportEngine.GeneratePages(
ReportViewer.Instance.Setting,
ReportViewer.Instance.TableData,
ReportViewer.Instance.ParameterData);
生成PDF
varpdf:PDF = new PDF();
for each(varpage:displayObjectin pages)
{
pdf.addPage();
pdf.addImage(page,new Resize(
org.alivepdf.layout.Mode.RESIZE_PAGE,
org.alivepdf.layout.Position.LEFT));
}
var bytes:*=pdf.save(org.alivepdf.saving.Method.LOCAL);
varfile:FileReference =newFileReference();
保存到本地,该方法要Flash player 10以上
file.save(bytes,"Export1.pdf");
}
导出的PDF效果
如何获取MyReport
相关文章
备注
*技术交流与合作:QQ: 791663094;Email:kong.yee@foxmail.com