Chat with us, powered by LiveChat

Solving problem with printing Flash content in Firefox browser

September 23rd, 2007 by Alex Batsuev

I will let out a secret: we have solved a problem with printing Flash/Flex applications in Firefox ๐Ÿ™‚

Here is the article how you can use it. ๐Ÿ˜‰

UPD3: LGPL license


Everybody knows that when you’re trying to get “Print preview” in Firefox some “strange” things happen: all Flash content disappears. But Internet Explorer displays everything correctly (it surprises me actually ๐Ÿ™‚ )

It is not good at all, because sometimes you want to print content of some web page, but you have to do some tricks with screenshots and so far and so on. Really boring…

Existing solutions

The thing is that no any solutions at all. Yes – you can print Flash only (by adding context menu item “Print”, by adding buttons into your flash movie, etc…). But there are no any ways to print whole web page.

Why should you carry about Firefox at all?

Answer is very simple – check out statistical numbers:
Numbers say more than words ๐Ÿ™‚

So – how can we solve this issue?

We’ll use URI scheme data:

What we want to do is to create a style for printing. This style will change Flash to image for Firefox browser. And you can use images in Firefox as img src=”data:image… “. Actually all these actions are automated already and all you need to do is to add JavaScript file, add swc library to the project and say, what you want to print.

Important note: it works only with Adobe Flash player 9 and higher.

Solution for Flex 2 (or later) Application

Let’s make your Flex application to print correctly in Firefox browser.

For example, we have simple application with text and image, like that:


Code of this application is very simple:

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”” layout=”absolute”>
<mx:Image source=”@Embed(source=’./../assets/logo_anychart.png’)” id=”anyChartLogo” x=”23″ y=”24″ width=”61″ height=”93″ />
<mx:Text x=”92″ y=”24″ height=”106″ width=”630″><mx:text>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Morbi ut justo a ipsum pellentesque auctor. Donec est.
Mauris porttitor elit a tellus. Nullam lorem tortor, luctus vitae,
dictum quis, pulvinar quis, ipsum. Vivamus at nunc non tortor imperdiet elementum.
Donec semper sagittis tortor. Nam luctus accumsan sapien. Proin pharetra mattis leo.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Duis sit amet magna nec diam ornare consequat. Curabitur odio enim, faucibus fringilla, accumsan id,
ultricies sit amet, est. Vivamus nec mauris vitae mi porta auctor. Curabitur eget lorem sit amet elit
accumsan iaculis. Sed blandit, leo eget sollicitudin bibendum, turpis metus sagittis urna, ut
nonummy justo mi vel nisi.

Let’s run it in Firefox and click Print Preview.

What do we see? Nothing:

For sure, nobody will like it.

So, we’ll try to fix it:

1. Download FFPrintFix.swc from:

2. Add it to folder libs of our project:
libs folder

3. Make Flex to add FFPrintFix to our project. To do it we do right-button click and select properties:


In Properties we go to Flex Build Path, then to Library path and click Add SWC.
Set path to libs/FFPrintFix.swc:
swc adding

Click ??, Then in properties OK again and wait while everything will be updated and recompile the project.

4. Now we will modify a template. Usually it is located in the folder html-templates with name index.template.html.
Then we download FFPrintFix.js here: and add it to the same folder html-template. Then wmodify template by adding import script:


Flex will copy FFPrintFix in the bin folder during compilation.

We’re almost done!

5. Initialization code.
Open our application and add initialization for printing:

<mx:Application xmlns:mx=”” layout=”absolute” applicationComplete=”updateImage()”> <mx:Script>

import com.anychart.utils.PrintManager;
public function updateImage():void {



PrintManager.setImage sets current state of scene as a view for printing in FireFox.

Now we run it, Click Print Preview and …


We’ve done it!

You can see screenshot of flash movie instead of empty space.

You can download the sample here:


PS: I will publish solution for Flash 9 and FDT a little bit later.
PPS: With FFPrintFix.swc source code for sure

Comments (13)


Alex Batsuev    9th Nov 07 10:42 pm

PS: And the first question in FAQ on the same page ๐Ÿ˜‰

  1. Reply
  2. Link
Alex Batsuev    9th Nov 07 10:41 pm

Sandy, you should call PrintManager.setPrintableContent in each changes in visualisation.
It sets current state as printable.
As I understand, you should call it after chart was drawed.

Step 2: set content to be printed in a browser

  1. Reply
  2. Link
Sandy    9th Nov 07 4:45 pm

I’m not sure what I’m doing wrong but when I run this from within flex it shows my charts but then after the chart is displayed it displays a copy of those charts but with no data…I think that is my image that it is creating. If I hit print preview I only see one and its the copy with no data.

Has anyone encountered this?

  1. Reply
  2. Link
David Maude    25th Oct 07 10:09 am

Hi, I was wondering if there is a non flex way of applying this solution for printing flash objects in mozilla? Cheers.

  1. Reply
  2. Link
Alex Batsuev    20th Oct 07 1:12 am

Yes, sure.
I’ll publish source code in 2 or 3 days.

  1. Reply
  2. Link
Ryan Knight    19th Oct 07 11:39 am


This is a great solution! Any chance you would be willing to share the source code (or email it to me)?

Thanks again!

  1. Reply
  2. Link
judah    2nd Oct 07 9:29 am

This is great! Thank you! ๐Ÿ™‚
I would say this is really a bug in the Flash Player so I reported it as a bug here

  1. Reply
  2. Link
BiMaWa    27th Sep 07 2:06 pm

It is impossible, its reality Fix the Bug with printing!! I love you Alex. You make my life is easier. This pae added in my favorites ๐Ÿ™‚ thx for you!

  1. Reply
  2. Link