My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

ex. ACPrintManager

flash-print-fix is a browser printing manager for flash content created by AnyChart.Com team. It is a small JavaScript and ActionScript 3 library.

Use flash-print-fix to prevent problems with Flash content printing from Firefox (usually Firefox doesn't display Flash content when printing HTML pages).

The main idea of this fix is to change the Flash content to image before printing or printing preview starts, and we do this using Flash ability to produce image and pass it to external interface and Firefox ability to display images using Data URI scheme.

Firefox page printing with flash content before flash-print-fix:

And after:

Download: http://code.google.com/p/flash-print-fix/downloads/list

Source code: http://code.google.com/p/flash-print-fix/source/checkout

How to use:

Usage in Flex project is very easy:

Step 1: Add swc to project

Step 2: Add js to html page

<script type="text/javascript" src="FlashPrintFix.js"></script>

Step 3: Initialize printable content

Just add:

FlashPrintFix.initializeApp();

when your app is ready to print.

Simple app example:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationPolicy="all" creationComplete="creationCompleteHandler(event)">
	<fx:Script>
		<![CDATA[
			import com.anychart.flashPrintFix.FlashPrintFix;
			
			import mx.events.FlexEvent;

			private function creationCompleteHandler(event:FlexEvent):void {
				FlashPrintFix.initializeApp();
			}

		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<mx:DataGrid x="10" y="10" width="418" height="323">
		<mx:columns>
			<mx:DataGridColumn headerText="Column 1" dataField="col1"/>
			<mx:DataGridColumn headerText="Column 2" dataField="col2"/>
			<mx:DataGridColumn headerText="Column 3" dataField="col3"/>
		</mx:columns>
	</mx:DataGrid>
	<s:Button x="442" y="10" label="Button"/>
	<s:CheckBox x="441" y="39" label="CheckBox"/>
</s:Application>



You can update printable content using update method:

FlashPrintFix.update(transparent:Boolean = true, bgColor:Number = 0xFFFFFFFF, matrix:Matrix = null):void

And set custom source for printing using setCustomSource method:

FlashPrintFix.setCustomSource(printSource:DisplayObject):void
Powered by Google Project Hosting