1-
flexreport基于alivepdf
可以打印较清晰的文字(包括控件上的文字和文本框中的文字...)。
关于横向打印功能,现阶段的结论是无法实现,因为受到printJob:FlexPrintJob的制约, 打印机宽,高,属性是只读的无法修改,printJob.start() 自后仍然无法修改。
AIR程序中flash.printing.PrintJob经过初步测试同样无法修改属性,官方api内容:“图像的打印方向。此属性是 PrintJobOrientation 类中的一个值。仅当调用 PrintJob.start() 方法后,此属性才是可用的。 ”,仍需要进一步测试。
现实使用方案: 1,手动修改flexreport的PaperFormat.A4R宽高参数,要求用户将打印机的默认设置改为纵向打印。2,使用javascript修改,具体实现方法不确定(注册表,安全限制等)。
测试中:_template.rotation=90; 结论:旋转后文字无法显示,使用字体样式后文字可以旋转,但只能对lable单体旋转时有效;
2-
AIR2中加入了新的打印机选项,可以实现横幅打印等打印记设置
pj.selectPaperSize(PaperSize.A4);
pj.orientation = PrintJobOrientation.LANDSCAPE;
pj.copies = 1;
pj.jobName = "Flash test print";
参考1:
http://www.bopit.in.th/2009/12/10/flex-report/
此文章提及了纵向打印修改设置内容,但测试发现是不可用的。
Flex Report
kemelyon FlexReport 0_2rc1 (LGPL)
- Layout A4,A3,A4R (landscape)
- Print Preview
- Multipage Print
3 Issue Fixed
- A4R print in source PaperFormat.as line 54
new PaperFormat([842, 595],“A4.Rotated”,[8.27,11.9],[210,297]);
- Error: Error #2030: End of file was encountered at flash.display::BitmapData/setPixels()
example code refer to FlexReportDemo.mxml
private function generateDocument():void
{
var source:ReportDP = new ReportDP();
var report:PortfolioReport = new PortfolioReport();
report.width = PaperFormat.A4R.width; // add this
report.height = PaperFormat.A4R.height;// add this
doc = new Document(report, source, PaperFormat.A4R);
doc.pdfEnabled = false;
printPreview.doc = doc;
}
private function initApplication():void
{
printPreview.pdfExportEnabled = false;
printPreview.page.width = PaperFormat.A4.width; // add this
printPreview.page.height = PaperFormat.A4.height; //add this
generateDocument();
}- print blank page or grey rectangle in the upper right corner Issue.
if (printJob.start()) {
setUpTemplate();
Application.application.addChild(template);
_template.height = printJob.pageHeight; // add this
_template.width = printJob.pageWidth; // add this
_template.validateNow();
_template.reset();参考2:
If you need to switch the layout to Landscape try the following (I used A4R):
1. In org.doc.PaperFormat.as switch the sizes in the A4R declaration:
public static const A4R : PaperFormat = new PaperFormat([842, 595],”A4.Rotated”,[11.9, 8.27],[297, 210]);
(not sure why A4R is the same as A4…)
2. add A4R to the paperFormats Array:
public static var paperFormats:Array = new Array(A3,A4,A4R, A5,LETTER,LEGAL,TABLOID);
3. In Preview.mxml change the width and height:
4. In FlexReportDemo.mxml change the Document() parameters:
doc = new Document(report, source, PaperFormat.A4R);
5. in DemoReport.mxml switch the height and width parameters:
That should get you landscape quickly to test preview (unless I missed something…
). The PDF print still needs work…
浙公网安备 33010602011771号