Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-17-2010, 05:20 PM   #1
Registered User
Join Date: Oct 2010
Posts: 26
Default AIR 2.0 - Get available printers


This is a question about how to use the "get printers ()" function. The quote below is from Adobe. But I have no idea how to implement it

What I've tried so far is:
var myPrintJob:PrintJob = new PrintJob();
myPrintJob.jobName = "test";
myPrintJob.printer = "CutePDF Writer";
txt_Debug.text = myPrintjob.printers();   //nope
txt_Debug.text = get printers();            //nope
txt_Debug.text = this.printers;              //nope
txt_Debug.text = printers();                 //nope
Does anyone have any idea how to implement this given the following:

From Adobe:
printers:Vector.<String>  [read-only]

Language Version: 	ActionScript 3.0
Runtime Versions: 	AIR 2

Provides a list of the available printers as String name values. 
The list is not precalculated; it is generated when the function is called. 
If no printers are available or if the system does not support printing, 
the value is null. If the system supports printing but is not capable of
returning a list of printers, the value is a Vector with a single element 
(its length property is 1). In that case, the single element is the actual
printer name or a default name if the current printer name cannot be

    public static function get printers():Vector.<String>
SuperMonkey is offline   Reply With Quote
Old 10-18-2010, 04:24 PM   #2
Registered User
Join Date: Oct 2010
Posts: 26

Well here's the answer

Getting the available printers and putting them in a combobox:
import fl.data.DataProvider;

var printerList:Vector.<String> = PrintJob.printers;
var arrPrinters:Array = new Array();
for (var i:int = 0; i < printerList.length; i++)
// set dataprovider for combobox    
cbo_PrinterSelection.dataProvider = new DataProvider(arrPrinters);
More info on printing and a downloadable demo source here:
blogs adobe com/koestler/2010/05/printing_in_air_2.html
SuperMonkey is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 04:33 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.