Chapter 19. Printing

FEATURED CLASSES

  • flash.printing.PrintJob

  • flash.printing.*

In this chapter, you learn how to print Flash content using the PrintJob class. You'll control what and how to print and even print documents differently than they appear on-screen. You'll also look at different approaches to printing.

Why Print from Flash?

ActionScript is used in many different contexts. For some of the more "traditional" applications, like a Flash banner, printing is out of the question. But with ActionScript being deployed in enterprise-level Flex applications and on the desktop in AIR applications, plenty of situations demand the ability to print, like a timesheet application or ticketing software for an airline.

Additionally, when you're talking about browser-based applications, browsers might not print the contents of a plug-in like Flash Player, so you may have no choice but to develop your own printing scheme.

Even better, when you use the print facilities in ActionScript, you have a lot of control over how things print. You can print multipage documents and control where they break pages; you can be aware of the printer's properties and use the correct page size, orientation, and margins; and you can create your own headers and footers. Of course, printing from Flash Player gives you the advantage of its display capabilities, such as precise layout, high-quality and low-file-size vector graphics, embedded custom fonts, and image processing using filters and BitmapData, to name a few. ...

Get ActionScript 3.0 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.