Adobe® Flash® Platform 用 ActionScript® 3.0 リファレンスガイド
ホーム  |  パッケージおよびクラスリストの非表示 |  パッケージ  |  クラス  |  新機能  |  索引  |  付録  |  英語で表示される理由
フィルター: AIR 30.0 以前, Flash Player 30.0 以前, Flash Lite 4
Flex 4.6 以前, Flash Pro CS6 以前
フィルターを非表示
flash.printing 

PrintJob  - AS3

パッケージx

トップレベル
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

言語エレメント

グローバル定数
グローバル関数
演算子
ステートメント、キーワード、ディレクティブ
特殊な型

付録

新機能
コンパイルエラー
コンパイラー警告
ランタイムエラー
ActionScript 3 への移行
サポートされている文字セット
MXML のみのタグ
モーション XML エレメント
Timed Text タグ
使用されなくなったエレメントのリスト
Accessibility Implementation 定数
ActionScript の例の使用方法
法律上の注意
パッケージflash.printing
クラスpublic class PrintJob
継承PrintJob Inheritance EventDispatcher Inheritance Object

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9

PrintJob クラスを使用すると、コンテンツを作成して 1 ページまたは複数のページに印刷できます。このクラスを使用すると、可視コンテンツをダイナミックにレンダリングまたは画面外でレンダリングし、1 つの印刷ダイアログボックスを使用して、コンテンツの縦横比を保持しつつ拡大縮小せずにドキュメントを印刷できます。この機能は、データベースコンテンツやダイナミックテキストなどのダイナミックコンテンツをレンダリングおよび印刷するときに特に便利です。

モバイルブラウザーのサポート:このクラスはモバイルブラウザーではサポートされません。

AIR プロファイルのサポート:この機能はすべてのデスクトップオペレーティングシステムでサポートされますが、モバイルデバイスまたは AIR for TV デバイスではサポートされません。PrintJob.isSupported プロパティを使用して、サポートされているかどうかを実行時にテストすることができます。複数のプロファイル間での API サポートについて詳しくは、AIR プロファイルのサポートを参照してください。

印刷ジョブを作成するには、PrintJob() コンストラクターを使用します。

さらに、PrintJob クラスのプロパティを使用すると、ユーザーのプリンター設定(用紙の高さ、幅、イメージの向きなど)にアクセスすることができ、プリンターの設定に合わせて Flash のコンテンツを動的にフォーマットするようにドキュメントを設定することができます。

注意:ActionScript 3.0 では、ActionScript の以前のバージョンと同様に、PrintJob オブジェクトが単一フレームに制限されません。ただし、印刷ダイアログボックスで「OK」ボタンをクリックすると印刷ステータス情報が表示されるため、ページをスプーラに送信したら直ちに PrintJob.addPage() および PrintJob.send() を呼び出す必要があります。PrintJob.send() 呼び出しの格納されたフレームに遅延が到達すると、印刷処理が遅延します。

また、次の間隔には、15 秒のスクリプトのタイムアウト制限が適用されます。

  • PrintJob.start() および 1 つ目の PrintJob.addPage()
  • PrintJob.addPage() および 2 つ目の PrintJob.addPage()
  • 最後の PrintJob.addPage() および PrintJob.send()

上記の間隔のいずれかが 15 秒以上である場合、次に PrintJob インスタンスの PrintJob.start() を呼び出したときに false が返されます。また、次に PrintJob インスタンスの PrintJob.addPage() を呼び出したときに、Flash Player または Adobe AIR からランタイム例外がスローされます。

例を表示



パブリックプロパティ
 プロパティ定義元
      active : Boolean
[静的] [読み取り専用] 印刷ジョブが現在アクティブであるかどうかを示します。
PrintJob
 Inheritedconstructor : Object
指定されたオブジェクトインスタンスのクラスオブジェクトまたはコンストラクター関数への参照です。
Object
      copies : int
それ以降に印刷ジョブに追加されたページについて、印刷システムが印刷する部数。
PrintJob
      firstPage : int
[読み取り専用] オペレーティングシステムの印刷ダイアログに入力された、印刷範囲の最初のページを示すページ番号です。
PrintJob
      isColor : Boolean
[読み取り専用] 現在の印刷設定で選択されているプリンターで、カラー(true)とグレースケール(false)のどちらを使用して印刷するかを示します。
PrintJob
  isSupported : Boolean
[静的] [読み取り専用] PrintJob クラスが現在のプラットフォームでサポートされているか(true)、サポートされていないか(false)を示します。
PrintJob
      jobName : String
印刷ジョブの名前またはタイトルです。
PrintJob
      lastPage : int
[読み取り専用] オペレーティングシステムの印刷ダイアログに入力された、印刷範囲の最後のページを示すページ番号です。
PrintJob
      maxPixelsPerInch : Number
[読み取り専用] 選択したプリンターの ppi(ピクセル/インチ)単位での実際の解像度。
PrintJob
  orientation : String
印刷するイメージの向きです。
PrintJob
  pageHeight : int
[読み取り専用] ページ上で実際に印刷可能な領域の中央に配置できる最大領域の高さ(ポイント単位)。
PrintJob
  pageWidth : int
[読み取り専用] ページ上で実際に印刷可能な領域の中央に配置できる最大領域の幅(ポイント単位)。
PrintJob
      paperArea : Rectangle
[読み取り専用] プリンターメディアの境界です(ポイント単位)。
PrintJob
  paperHeight : int
[読み取り専用] 用紙全体の高さ(ポイント単位)です。
PrintJob
  paperWidth : int
[読み取り専用] 用紙全体の幅(ポイント単位)です。
PrintJob
      printableArea : Rectangle
[読み取り専用] プリンターメディアの印刷可能範囲の境界です(ポイント単位)。
PrintJob
      printer : String
現在の印刷ジョブに使用されるプリンターを取得または設定します。
PrintJob
      printers : Vector.<String>
[静的] [読み取り専用] 使用可能なプリンターのリストを、String 名の値として提供します。
PrintJob
      supportsPageSetupDialog : Boolean
[静的] [読み取り専用] Flash ランタイム環境で個別のページ設定ダイアログがサポートされるかどうかを示します。
PrintJob
パブリックメソッド
 メソッド定義元
  
ページを印刷できる PrintJob オブジェクトを作成します。
PrintJob
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
イベントリスナーオブジェクトを EventDispatcher オブジェクトに登録し、リスナーがイベントの通知を受け取るようにします。
EventDispatcher
  
addPage(sprite:Sprite, printArea:Rectangle = null, options:PrintJobOptions = null, frameNum:int = 0):void
指定の Sprite オブジェクトを 1 ページとして印刷スプーラに送ります。
PrintJob
 Inherited
イベントをイベントフローに送出します。
EventDispatcher
 Inherited
EventDispatcher オブジェクトに、特定のイベントタイプに対して登録されたリスナーがあるかどうかを確認します。
EventDispatcher
 Inherited
オブジェクトに指定されたプロパティが定義されているかどうかを示します。
Object
 Inherited
Object クラスのインスタンスが、パラメーターとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。
Object
 Inherited
指定されたプロパティが存在し、列挙できるかどうかを示します。
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
EventDispatcher オブジェクトからリスナーを削除します。
EventDispatcher
  
    selectPaperSize(paperSize:String):void
用紙サイズを設定します。
PrintJob
  
start() または start2() メソッドおよび addPage() メソッドの呼び出しに成功した後、スプールされたページをプリンターに送信します。
PrintJob
 Inherited
ループ処理に対するダイナミックプロパティの可用性を設定します。
Object
  
現在の環境でサポートされている場合、オペレーティングシステムのページ設定ダイアログを表示します。
PrintJob
  
オペレーティングシステムの印刷ダイアログボックスを表示し、スプールを開始します。
PrintJob
  
    start2(uiOptions:PrintUIOptions = null, showPrintDialog:Boolean = true):Boolean
必要に応じて、オペレーティングシステムの印刷ダイアログボックスを表示してスプールを開始し、PrintJob の読み取り専用プロパティ値を編集することもできます。
PrintJob
  
    terminate():void
印刷ジョブが送信されずに終了することを通知します。
PrintJob
 Inherited
ロケール固有の規則に従って書式設定された、このオブジェクトのストリング表現を返します。
Object
 Inherited
指定されたオブジェクトのストリング表現を返します。
Object
 Inherited
指定されたオブジェクトのプリミティブな値を返します。
Object
 Inherited
指定されたイベントタイプについて、この EventDispatcher オブジェクトまたはその祖先にイベントリスナーが登録されているかどうかを確認します。
EventDispatcher
イベント
 イベント 概要 定義元
 Inherited[ブロードキャストイベント] Flash Player または AIR アプリケーションがオペレーティングシステムのフォーカスを取得して、アクティブになったときに送出されます。EventDispatcher
 Inherited[ブロードキャストイベント] Flash Player または AIR アプリケーションがオペレーティングシステムのフォーカスを失って、非アクティブになったときに送出されます。EventDispatcher
プロパティの詳細
    

active

プロパティ
active:Boolean  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

印刷ジョブが現在アクティブであるかどうかを示します。次の 2 つの状況のいずれかで、印刷ジョブがアクティブ(プロパティ値が true)です。

  • ページ設定ダイアログまたは印刷ダイアログが表示されている。
  • 戻り値 true によって、start() または start2() メソッドが呼び出し済みであり、かつ send() または terminate() メソッドが呼び出されていない場合。

このプロパティが true の場合に、showPageSetupDialog()start()、または start2() メソッドを呼び出すと、ランタイムによって例外がスローされます。



実装
    public static function get active():Boolean

関連する API エレメント

    

copies

プロパティ 
copies:int

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

それ以降に印刷ジョブに追加されたページについて、印刷システムが印刷する部数。この値は、オペレーティングシステムの印刷ダイアログに入力された印刷部数です。印刷部数が印刷ダイアログに表示されなかった場合、または印刷ダイアログがユーザーに表示されなかった場合、この値は 1 です(アプリケーションコードによって変更された場合を除く)。



実装
    public function get copies():int
    public function set copies(value:int):void
    

firstPage

プロパティ 
firstPage:int  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

オペレーティングシステムの印刷ダイアログに入力された、印刷範囲の最初のページを示すページ番号です。すべてのページを印刷するように要求された場合、ページ範囲が印刷ダイアログに表示されなかった場合、または印刷ダイアログがユーザーに表示されていない場合は、このプロパティは 0 です。



実装
    public function get firstPage():int
    

isColor

プロパティ 
isColor:Boolean  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

現在の印刷設定で選択されているプリンターで、カラー(true)とグレースケール(false)のどちらを使用して印刷するかを示します。

カラーとグレースケールのどちらを使用するのか値を特定できない場合は、値は true です。



実装
    public function get isColor():Boolean

isSupported

プロパティ 
isSupported:Boolean  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10.1, AIR 2

PrintJob クラスが現在のプラットフォームでサポートされているか(true)、サポートされていないか(false)を示します。



実装
    public static function get isSupported():Boolean
    

jobName

プロパティ 
jobName:String

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

印刷ジョブの名前またはタイトルです。ジョブ名は、通常は印刷キュー内にあるジョブのタイトルとして、またはファイルに出力されるジョブのデフォルト名として、オペレーティングシステムによって使用されます。

start() または start2() を呼び出さず、プロパティの値も設定していなかった場合、このプロパティの値は null になります。

PrintJob インスタンスで実行する各印刷ジョブに対して、start() または start2() メソッドを呼び出す前にこのプロパティを設定します。

デフォルト値: null



実装
    public function get jobName():String
    public function set jobName(value:String):void

例外
IllegalOperationError active プロパティが true の場合に、コードがプロパティを設定しようと試みた場合。
    

lastPage

プロパティ 
lastPage:int  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

オペレーティングシステムの印刷ダイアログに入力された、印刷範囲の最後のページを示すページ番号です。すべてのページを印刷するように要求された場合、ページ範囲が印刷ダイアログに表示されなかった場合、または印刷ダイアログがユーザーに表示されていない場合は、このプロパティは 0 です。



実装
    public function get lastPage():int
    

maxPixelsPerInch

プロパティ 
maxPixelsPerInch:Number  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

選択したプリンターの ppi(ピクセル/インチ)単位での実際の解像度。値は、オペレーティングシステムによってレポートされる現在の印刷設定に応じて計算されます。

解像度を特定できない場合、値は標準のデフォルト値になります。デフォルト値は Linux では 600 ppi で、Mac OS では 360 ppi です。Windows では、プリンターの解像度は常に取得できるので、デフォルト値は必要ありません。



実装
    public function get maxPixelsPerInch():Number

orientation

プロパティ 
orientation:String

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 9 - read only, AIR 1.0 - read only, AIR 2 - read-write

印刷するイメージの向きです。指定可能な値は、PrintJobOrientation クラスの定数として定義されています。

注意:ARI 2 以降では、印刷ジョブを開始する前にこのプロパティを設定し、ページ設定ダイアログと印刷ダイアログでのデフォルトの向きを設定します。start() または start2() を呼び出した後、印刷ジョブの進行中にこのプロパ ィを設定し、ジョブ内のページ範囲の向きを設定します。



実装
    public function get orientation():String
    public function set orientation(value:String):void

関連する API エレメント

pageHeight

プロパティ 
pageHeight:int  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9.

ページ上で実際に印刷可能な領域の中央に配置できる最大領域の高さ(ポイント単位)。ユーザーが設定した余白は含みません。このプロパティは、PrintJob.start() メソッドの呼び出し後にのみ使用可能になります。

注意:AIR 以降では、このプロパティの使用は避けてください。代わりに、printableArea を使用してください。これは、印刷可能領域を少数(ポイント単位)で測定し、印刷可能領域からはみ出した部分について正確に記述します。



実装
    public function get pageHeight():int

関連する API エレメント

pageWidth

プロパティ 
pageWidth:int  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 9, AIR 1.0

ページ上で実際に印刷可能な領域の中央に配置できる最大領域の幅(ポイント単位)。ユーザーが設定した余白は含みません。このプロパティは、PrintJob.start() メソッドの呼び出し後にのみ使用可能になります。

注意:AIR 以降では、このプロパティの使用は避けてください。代わりに、printableArea を使用してください。これは、印刷可能領域を少数(ポイント単位)で測定し、印刷可能領域からはみ出した部分について正確に記述します。



実装
    public function get pageWidth():int

関連する API エレメント

    

paperArea

プロパティ 
paperArea:Rectangle  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

プリンターメディアの境界です(ポイント単位)。この値は、以降の addPage() 呼び出しで使用されるのと同じ座標系を使用します。



実装
    public function get paperArea():Rectangle

paperHeight

プロパティ 
paperHeight:int  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9.

用紙全体の高さ(ポイント単位)です。このプロパティは、PrintJob.start() メソッドの呼び出し後にのみ使用可能になります。

注意:AIR 以降では、このプロパティの使用は避けてください。代わりに、paperArea を使用してください。これは、用紙サイズを少数(ポイント単位)に分割して測定します。



実装
    public function get paperHeight():int

関連する API エレメント

paperWidth

プロパティ 
paperWidth:int  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9.

用紙全体の幅(ポイント単位)です。このプロパティは、PrintJob.start() メソッドの呼び出し後にのみ使用可能になります。

注意:AIR 以降では、このプロパティの使用は避けてください。代わりに、paperArea を使用してください。これは、用紙サイズを少数(ポイント単位)に分割して測定します。



実装
    public function get paperWidth():int

関連する API エレメント

    

printableArea

プロパティ 
printableArea:Rectangle  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

プリンターメディアの印刷可能範囲の境界です(ポイント単位)。この値は、以降の addPage() 呼び出しで使用されるのと同じ座標系を使用します。



実装
    public function get printableArea():Rectangle
    

printer

プロパティ 
printer:String

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

現在の印刷ジョブに使用されるプリンターを取得または設定します。setter に渡され、getter から返される String は、printers() メソッドから返された Array 内のいずれかのストリングに一致します。デフォルトプリンターを使用することを示すには、値を null に設定します。デフォルトプリンターを特定できないオペレーティングシステム上では、このプロパティ値は null です。

     import flash.printing.PrintJob;
     
     var myPrintJob:PrintJob = new PrintJob();
     myPrintJob.printer = "HP_LaserJet_1";
     myPrintJob.start();
     

このプロパティの値を設定すると、直ちにプリンターの選択が実行されます。プリンターの選択に失敗した場合、このプロパティの値は以前の値にリセットされます。このプリンター値の設定が成功したかどうかは、値の設定を試行した後に値を読み取り、設定した値と読み取った値が一致することを確認することにより、判別できます。

アクティブな印刷ジョブの printer プロパティは変更できません。start() または start2() メソッドの呼び出しに成功した後、send() または terminate() の呼び出し前にこの値を変更しようとすると、失敗します。



実装
    public function get printer():String
    public function set printer(value:String):void
    

printers

プロパティ 
printers:Vector.<String>  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

使用可能なプリンターのリストを、String 名の値として提供します。リストは事前に計算済みのものではなく、この関数が呼び出されたときに作成されます。使用可能なプリンターがない場合、またはシステムが印刷をサポートしていない場合、値は null を返します。システムで印刷をサポートしているが、プリンターのリストを返せない場合は、戻り値は 1 個の要素を持つ Vector になります(length プロパティは 1 です)。この場合、この 1 個の要素は実際のプリンター名を表すか、プリンター名が特定できない場合はデフォルトのプリンター名を表します。



実装
    public static function get printers():Vector.<String>
    

supportsPageSetupDialog

プロパティ 
supportsPageSetupDialog:Boolean  [読み取り専用]

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

Flash ランタイム環境で個別のページ設定ダイアログがサポートされるかどうかを示します。このプロパティが true の場合、showPageSetupDialog() メソッドを呼び出してオペレーティングシステムのページ設定ダイアログボックスを表示できます。



実装
    public static function get supportsPageSetupDialog():Boolean

関連する API エレメント

コンストラクターの詳細

PrintJob

()コンストラクター
public function PrintJob()

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9

ページを印刷できる PrintJob オブジェクトを作成します。PrintJob オブジェクトを作成したら、PrintJob.start()PrintJob.addPage()PrintJob.send() の順にメソッドを使用して、プリンターに印刷ジョブを送信します。

例えば、次のコードに示すように、myPrintJob.addPage() メソッド呼び出しの [params] プレースホルダーテキストをカスタムパラメーターに置き換えることができます。

 // create PrintJob object
 var myPrintJob:PrintJob = new PrintJob();
  
 // display Print dialog box, but only initiate the print job
 // if start returns successfully.
 if (myPrintJob.start()) {
  
    // add specified page to print job
    // repeat once for each page to be printed
    try {
      myPrintJob.addPage([params]);
    }
    catch(e:Error) {
      // handle error 
    }
    try {
      myPrintJob.addPage([params]);
    }
    catch(e:Error) {
      // handle error 
    }
 
    // send pages from the spooler to the printer, but only if one or more
    // calls to addPage() was successful. You should always check for successful 
    // calls to start() and addPage() before calling send().
    myPrintJob.send();
 }
 

AIR 2 以降では、複数の PrintJob インスタンスを作成して使用できます。PrintJob インスタンスに設定されたプロパティは、印刷の完了後も保持されます。これにより、アプリケーション内の別のコンテンツに対して異なる印刷環境設定を適用する一方で、PrintJob インスタンスを再利用し、ユーザーによって選択された印刷環境設定を保持することができます。Flash Player および AIR 2 より前のバージョンの AIR では、最初の PrintJob オブジェクトがまだアクティブなときには、2 つ目の PrintJob オブジェクトを作成できません。1 つ目の PrintJob オブジェクトがアクティブであるときに new PrintJob() を呼び出して 2 つ目の PrintJob オブジェクトを作成しようとしても、2 つ目の PrintJob オブジェクトは生成されません。そのため、2 つ目の PrintJob を作成する前に myPrintJob 値を確認できます。


例外
IllegalOperationError — Flash Player および AIR 2 より前のバージョンの AIR では、別の PrintJob オブジェクトがまだアクティブな場合に例外がスローされます。

関連する API エレメント

メソッドの詳細

addPage

()メソッド
public function addPage(sprite:Sprite, printArea:Rectangle = null, options:PrintJobOptions = null, frameNum:int = 0):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9.

指定の Sprite オブジェクトを 1 ページとして印刷スプーラに送ります。このメソッドを使用する前に、PrintJob オブジェクトを作成し、start() または start2() を使用する必要があります。次に、印刷ジョブに対して addPage() を 1 回または複数回呼び出した後、send() を使用して、スプールしたページをプリンターに送信します。つまり、PrintJob オブジェクトを作成したら、start()start2()()addPage()send() の順にメソッドを使用して、プリンターに印刷ジョブを送信します。start() を 1 回呼び出した後、addPage() を複数回呼び出して、1 回の印刷ジョブで複数のページを印刷できます。

addPage() によって Flash Player が例外をスローした場合(start() を呼び出していなかった場合や、ユーザーが印刷ジョブをキャンセルした場合など)は、それ以降の addPage() の呼び出しはすべて失敗します。ただし、それ以前の addPage() の呼び出しが成功していれば、最後に send() コマンドを実行することで、スプールされていたすべてのページがプリンターに送られます。

印刷ジョブで addPage() 操作の完了に 15 秒以上かかる場合、Flash Player は、次回 addPage() が呼び出されたときに例外をスローします。

printArea パラメーターの値を渡すと、printArea 矩形の x 座標と y 座標が、ページの印刷可能領域の左上隅(0, 0 座標)にマップされます。読み取り専用プロパティ pageHeightpageWidth は、start() によって設定された印刷可能領域を示します。印刷結果はページ上の印刷可能領域の左上隅を基準に整列されるので、printArea で定義した領域が用紙上の印刷可能領域よりも大きい場合は、printArea で定義した領域の右側または下側の部分(またはその両方)は切り取られることがあります。Flash Professional では、printArea の値を指定しない場合にステージが印刷可能領域よりも大きいと、同様の切り取りが発生します。Flex または Flash Builder では、printArea の値を指定しない場合にスクリーンが印刷可能領域よりも大きいと、同様の切り取りが発生します。

印刷前に Sprite オブジェクトを拡大/縮小するには、このメソッドを呼び出す前に拡大 / 縮小のプロパティ(flash.display.DisplayObject.scaleX および flash.display.DisplayObject.scaleY を参照)を設定します。印刷後、これらのプロパティを元の値に戻します。Sprite オブジェクトの拡大 / 縮小は、printArea とは無関係です。つまり、サイズが 50 × 50 ピクセルの領域を印刷するよう指定した場合、2500 ピクセルが印刷されます。Sprite オブジェクトを拡大 / 縮小している場合、その設定を反映してプリント結果は伸縮しますが、プリントの対象となる 2500 個のピクセルは変わりません。

Flash Player の印刷機能は、PostScript プリンターと非 PostScript プリンターをサポートしています。非 PostScript プリンターでは、ベクターはビットマップに変換されます。

パラメーター

sprite:Sprite — 印刷するコンテンツが含まれている Sprite。
 
printArea:Rectangle (default = null) — 印刷する領域を指定する Rectangle オブジェクトです。

矩形の幅と高さはピクセル値です。プリンターでは、印刷用の測定単位としてポイントを使用します。ポイントは物理的な固定サイズ(1/72 インチ)ですが、画面用のピクセル深度のサイズは画面の解像度によって異なります。そのためピクセルとポイントの間の変換レートは、プリンターの設定、および Sprite が伸縮されているかどうかによって決まります。72 ピクセル幅の伸縮されていない Sprite は、用紙上では 1 インチ幅で印刷されます。1 ポイントは 1 ピクセルに相当し、画面の解像度とは無関係です。

インチおよびセンチメートルと、ポイントおよび twip(1/20 ポイント)との間には、次の等式が成り立ちます。

  • 1 ポイント = 1/72 インチ = 20 twip
  • 1 インチ = 72 ポイント = 1440 twip
  • 1 cm = 567 twips

printArea パラメーターを省略するか、このパラメーターの指定が正しくない場合は、sprite 全体がプリントされます。

printArea の値を指定せずに、options または frameNum の値を指定するには、printAreanull を指定します。

 
options:PrintJobOptions (default = null) — ベクターとビットマップのどちらで印刷するかを指定する、オプションのパラメーター。デフォルト値は null で、これはベクター形式を示します。sprite をビットマップとして印刷するには、PrintJobOptions オブジェクトの printAsBitmap プロパティを true に設定します。printAsBitmaptrue に設定するかどうかを決めるときには、次の項目に留意してください。
  • 印刷するコンテンツにビットマップイメージが含まれる場合は、アルファ透明効果とカラー効果を含めるために printAsBitmaptrue に設定します。
  • コンテンツにビットマップイメージが含まれない場合は、このパラメーターを省略して、より品質の高いベクター形式で印刷します。

options を省略した場合、または間違った値を渡した場合は、ベクター形式が使用されます。options の値を指定せずに、frameNumber の値を指定するには、optionsnull を指定します。

 
frameNum:int (default = 0) — 印刷する MovieClip オブジェクトのフレームを指定する数値。これはオプションです。frameNum を渡しても、そのフレーム上の ActionScript は呼び出されません。このパラメーターを省略し、かつ sprite パラメーターが MovieClip オブジェクトである場合は、sprite 内の現在のフレームが印刷されます。


例外
Error start() を呼び出さなかった場合、またはユーザーが印刷ジョブをキャンセルした場合、例外がスローされます。

関連する API エレメント

    selectPaperSize

()メソッド 
public function selectPaperSize(paperSize:String):void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

用紙サイズを設定します。paperSize パラメーターとして指定できる値は、PaperSize クラスの定数です。このメソッドを呼び出すと、ページ設定ダイアログまたは印刷ダイアログでユーザーが用紙サイズを選択した場合と同じように、印刷設定に影響します。

このメソッドは、いつでも呼び出すことができます。このメソッドは、ページ設定ダイアログと印刷ダイアログでデフォルトの用紙サイズを設定するジョブを開始する前に呼び出します。このメソッドは、印刷ジョブの進行中に呼び出して、ジョブ内のページ範囲に対する用紙サイズを設定します。

     import flash.printing.PrintJob;
     import flash.printing.PaperSize;
     
     var myPrintJob:PrintJob = new PrintJob();
     myPrintJob.selectPaperSize(PaperSize.ENV_10);
     

パラメーター

paperSize:String — 印刷ジョブのそれ以降のページに対して使用される用紙サイズ。


例外
ArgumentError paperSize パラメーターが、PaperSize クラスで定義された指定可能な値の 1 つではない場合。

関連する API エレメント

send

()メソッド 
public function send():void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9.

start() または start2() メソッドおよび addPage() メソッドの呼び出しに成功した後、スプールされたページをプリンターに送信します。

start() または start2() メソッドへの呼び出しが失敗した場合、または addPage() メソッドへの呼び出しが例外をスローした場合、このメソッドは成功しません。エラーを回避するには、このメソッドを呼び出す前に、start() または start2() メソッドが true を返し、addPage() 例外がある場合はそれをキャッチしていることを確認します。次の例では、このメソッドを呼び出す前にエラーを適切に確認する方法について説明します。

     var myPrintJob:PrintJob = new PrintJob();
     if (myPrintJob.start()) {
       try {
         myPrintJob.addPage([params]);
       }
       catch(e:Error) {
          // handle error 
       }
     
       myPrintJob.send();
     }
     

関連する API エレメント

    showPageSetupDialog

()メソッド 
public function showPageSetupDialog():Boolean

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

現在の環境でサポートされている場合、オペレーティングシステムのページ設定ダイアログを表示します。ページ設定がサポートされているかどうかを確認するには、supportsPageSetupDialog プロパティを使用します。

     import flash.printing.PrintJob;
     
     var myPrintJob:PrintJob = new PrintJob();
     if (myPrintJob.supportsPageSetupDialog)
     {
         myPrintJob.showPageSetupDialog();
     }
     

戻り値
Boolean — ページ設定ダイアログで「OK」を選択した場合には、true。これは、一部の PrintJob プロパティが変更された可能性があることを示します。ユーザーがページ設定ダイアログで「キャンセル」をクリックした場合は、false を返します。

例外
IllegalOperationError — システムでページ設定がサポートされない場合。ページ設定がサポートされているかどうかを確認するには、supportsPageSetupDialog プロパティを使用します。
 
IllegalOperationError — 任意の印刷ジョブ(実行中のジョブも含む)がアクティブである場合。

関連する API エレメント

start

()メソッド 
public function start():Boolean

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 1.0, Flash Player 9., Flash Player 9.

オペレーティングシステムの印刷ダイアログボックスを表示し、スプールを開始します。ユーザーは印刷ダイアログボックスで印刷設定を変更できます。PrintJob.start() メソッドが正常に返された場合、つまりユーザーが印刷ダイアログボックスで「OK」をクリックした場合、ユーザーが選択した印刷設定を表す値が次のプロパティに設定されます。

プロパティ単位メモ
PrintJob.paperHeightNumberポイント用紙の高さ
PrintJob.paperWidthNumberポイント用紙全体の幅
PrintJob.pageHeightNumberポイント用紙上の実際の印刷可能領域の高さ。ユーザーが設定した余白は含みません。
PrintJob.pageWidthNumberポイント用紙上の実際の印刷可能領域の幅。ユーザーが設定した余白は含みません。
PrintJob.orientationString"portrait"flash.printing.PrintJobOrientation.PORTRAIT)または "landscape"flash.printing.PrintJobOrientation.LANDSCAPE)。

注意:ユーザーが印刷ダイアログボックスでキャンセルすると、プロパティは設定されません。

ユーザーが印刷ダイアログボックスで「OK」をクリックすると、オペレーティングシステムへの印刷ジョブのスプールが開始されます。オペレーティングシステムで印刷の進行状況について情報が表示されるため、ページをスプーラに送信したら直ちに PrintJob.addPage() および PrintJob.send() を呼び出す必要があります。このメソッドによって値が設定された読み取り専用の高さ、幅、方向のプロパティを使用して、印刷結果をフォーマットできます。

PrintJob.addPage()PrintJob.send() を呼び出す前に、このメソッドが true を返すこと(ユーザーがオペレーティングシステムの印刷ダイアログボックスで「OK」をクリックした場合)を確認するために、テストを行います。

     var myPrintJob:PrintJob = new PrintJob();
        if(myPrintJob.start()) {
          // addPage() and send() statements here
        }
     

特定の印刷ジョブインスタンスでは、次の間隔のいずれかが 15 秒を超えると、PrintJob.start() の次の呼び出しによって false が返されます。

  • PrintJob.start() および 1 つ目の PrintJob.addPage()
  • 1 つの PrintJob.addPage() と次の PrintJob.addPage()
  • 最後の PrintJob.addPage() および PrintJob.send()

戻り値
Boolean — 印刷ダイアログボックスでユーザーが「OK」をクリックした場合は true、ユーザーが「キャンセル」をクリックした場合、またはエラーが発生した場合は false を返します。

例外
IllegalOperationError — AIR 以降で、別の PrintJob が現在アクティブになっている場合。

関連する API エレメント

    start2

()メソッド 
public function start2(uiOptions:PrintUIOptions = null, showPrintDialog:Boolean = true):Boolean

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

必要に応じて、オペレーティングシステムの印刷ダイアログボックスを表示してスプールを開始し、PrintJob の読み取り専用プロパティ値を編集することもできます。

uiOptions パラメーターを使用すると、印刷ダイアログに表示するオプションを呼び出し側で制御できます。詳しくは、PrintUIOptions クラスを参照してください。このパラメーターは、showPrintDialog が false の場合は無視されます。

showPrintDialogtrue であっても、このメソッドの動作が start() メソッドの動作と異なることがあります。一部のオペレーティングシステムでは、start() によって、まずページ設定ダイアログが表示され、続いて印刷ダイアログが表示されます。一方、start2() では、ページ設定ダイアログは表示されません。

次の例では、印刷ダイアログがユーザーに表示される前に、印刷ダイアログの最小ページおよび最大ページ設定が設定されます。

     import flash.printing.PrintJob;
     import flash.printing.PrintUIOptions;
     
     var myPrintJob:PrintJob = new PrintJob();
     var uiOpt:PrintUIOptions = new PrintUIOptions();
     uiOpt.minPage = 1;
     uiOpt.maxPage = 3;
     var accepted:Boolean = myPrintJob.start2(uiOpt);
     

パラメーター

uiOptions:PrintUIOptions (default = null) — ユーザーに表示される印刷ダイアログに表示するオプションを指定するオブジェクト。showPrintDialog パラメーターが false の場合、この値は無視されます。
 
showPrintDialog:Boolean (default = true) — 印刷ジョブを開始する前に、印刷ダイアログをユーザーに表示するかどうかを指定します。

戻り値
Boolean — 印刷ダイアログボックスでユーザーが「OK」をクリックした場合、または印刷ダイアログが表示されておらず、エラーがない場合は true を返し、ユーザーが「キャンセル」をクリックした場合、またはエラーが発生した場合は false を返します。

例外
IllegalOperationError — ページ設定ダイアログが表示されている場合、または別の印刷ジョブが現在アクティブである場合。

関連する API エレメント

    terminate

()メソッド 
public function terminate():void

言語バージョン: ActionScript 3.0
ランタイムバージョン: AIR 2

印刷ジョブが送信されずに終了することを通知します。このメソッドは、start() または start2() を呼び出すことによって印刷ジョブが既に開始されているが、ページをプリンターに送信することが適切ではない場合に使用します。通常、terminate() は、エラーから回復するためにのみ使用されます。

このメソッドを呼び出した後、PrintJob インスタンスは再利用できます。可能な場合は常に、ジョブの印刷設定は、次回以降に使用できるように保持されます。

PrintJobExample_Simple.as

次の例では、印刷の基本を示します。新しい PrintJob が作成され、正常に開始された後は、addPage() メソッドによってスプライトが単一のページとして追加されます。send() メソッドによって、プリンターにページがスプールされます。
package 
{ 
    import flash.printing.PrintJob; 
    import flash.display.Sprite; 
 
    public class BasicPrintExample extends Sprite 
    { 
        var myPrintJob:PrintJob = new PrintJob(); 
        var mySprite:Sprite = new Sprite();
        mySprite.graphics.beginFill(0x336699);
    mySprite.graphics.drawCircle(100, 100, 50);
 
        public function BasicPrintExample() 
        { 
            if (myPrintJob.start()) {
            try {
                myPrintJob.addPage(mySprite);
            }
            catch(e:Error) {
                // handle error 
            }
            myPrintJob.send();
        } 
    } 
}
PrintJobExample.as

次の例では、クラス PrintJobExample を使用して小さな文書を作成し、その文書をプリンターに送ります。ここでは以下の手順を実行します。
  1. sheet1 および sheet2 という名前の Sprite 型の 2 つの変数を宣言します。
  2. init() を呼び出します。これは、新しい Sprite インスタンスを sheet1sheet2 に割り当てた後、別の引数を使用して createSheet() を呼び出します。
  3. createSheet() は、以下の処理を行います。
    1. 渡された Sprite オブジェクトを使用して矩形を描画します。これは、明るい灰色の背景に 1 ピクセルの黒い境界線を使用し、x = 0、y = 0 の位置に幅 100 ピクセル、高さ 200 ピクセルで描画されます。
    2. 新しい TextField オブジェクトが作成されます。この名前は txt であり、Sprite と同じサイズです。wordWrap プロパティは true に設定され、テキストプロパティは createSheet() への引数として渡される String に設定されます。
    3. 渡された Object 引数が null ではない場合、新しい Sprite インスタンスを作成します。このインスタンスの名前は img であり、渡されたオブジェクトの座標およびサイズのプロパティを使用して、白い矩形を描画するときに使用されます。addChild() を使用して、白い四角形を Sprite オブジェクトの表示リストに追加します。
    4. addChild() を使用して、txt TextField を Sprite オブジェクトの表示リストに追加します。
  4. コンストラクターに戻ると、有効な(コメントアウトされていない)印刷メソッドが呼び出されます。これらのメソッドは非常に似ているため、printOnePerPage() については後で説明します。
  5. printOnePerPage() は、以下の処理を行います。
    1. 新しい PrintJob オブジェクトを宣言します。オブジェクトには uint 型として pjpagesToPrint という名前を付けます。
    2. オペレーティングシステムのネイティブの印刷ダイアログボックスを開き、ユーザーが OK をクリックするまで待機します。
    3. 原点を確認し、「横」が選択されている場合は、エラーをスローして終了します。
    4. sheet1sheet2 にページの高さと幅を設定します。
    5. sheet1 および sheet2 を印刷スプーラに送ります(addPage() を使用)。
    6. 印刷するページ数が 1 ページ以上ある場合は、スプールされたページをすべて印刷します。
  6. draw() メソッドが呼び出されます。このメソッドによりステージに合わせて 2 つの Sprite プロパティのサイズが変更され、sheet2sheet1 の右側になるように再配置されます。

メモ:コンストラクターは、必要に応じて、ページあたり 1 シート、ページあたり 2 シート、またはページの上半分に印刷の 3 つの印刷メソッドのいずれかを選択できるように設定されます。コードコメントを使用して印刷メソッドのうちちょうど 2 つが無効にされている場合に限り、この例は適切に動作します。この例は、printOnePerPage() が呼び出されるように設定されています。

package {
    import flash.printing.PrintJob;
    import flash.printing.PrintJobOrientation;
    import flash.display.Stage;
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.geom.Rectangle;
       
    public class PrintJobExample extends Sprite {
        private var sheet1:Sprite;
        private var sheet2:Sprite;
           
        public function PrintJobExample() {
            init();
            printOnePerPage();
//            printTwoPerPage();
//            printTopHalf();
            draw();
        }
        
        private function init():void {
            sheet1 = new Sprite();
            createSheet(sheet1, "Once upon a time...", {x:10, y:50, width:80, height:130});

            sheet2 = new Sprite();
            createSheet(sheet2, "There was a great story to tell, and it ended quickly.\n\nThe end.", null);
        }
        
        private function createSheet(sheet:Sprite, str:String, imgValue:Object):void {
            sheet.graphics.beginFill(0xEEEEEE);
            sheet.graphics.lineStyle(1, 0x000000);
            sheet.graphics.drawRect(0, 0, 100, 200);
            sheet.graphics.endFill();
            
            var txt:TextField = new TextField();
            txt.height = 200;
            txt.width = 100;
            txt.wordWrap = true;
            txt.text = str;
            
            if(imgValue != null) {
                var img:Sprite = new Sprite();
                img.graphics.beginFill(0xFFFFFF);
                img.graphics.drawRect(imgValue.x, imgValue.y, imgValue.width, imgValue.height);
                img.graphics.endFill();
                sheet.addChild(img);
            }
            sheet.addChild(txt);
        }
        
        private function printOnePerPage():void {
            var pj:PrintJob = new PrintJob();
            var pagesToPrint:uint = 0;
            if(pj.start()) {                
                if(pj.orientation == PrintJobOrientation.LANDSCAPE) {    
                    throw new Error("Without embedding fonts you must print one sheet per page with an orientation of portrait.");
                }
                
                sheet1.height = pj.pageHeight;
                sheet1.width = pj.pageWidth;
                sheet2.height = pj.pageHeight;
                sheet2.width = pj.pageWidth;

                try {
                    pj.addPage(sheet1);
                    pagesToPrint++;
                }
                catch(e:Error) {
                    // do nothing
                }

                try {
                    pj.addPage(sheet2);
                    pagesToPrint++;
                }
                catch(e:Error) {
                    // do nothing
                }

                if(pagesToPrint > 0) {
                    pj.send();
                }
            }
        }
        
        private function printTwoPerPage():void {
            var pj:PrintJob = new PrintJob();
            var pagesToPrint:uint = 0;
            if(pj.start()) {                
                if(pj.orientation == PrintJobOrientation.PORTRAIT) {
                    throw new Error("Without embedding fonts you must print two sheets per page with an orientation of landscape.");
                }
                
                sheet1.height = pj.pageHeight;
                sheet1.width = pj.pageWidth/2;
                sheet2.height = pj.pageHeight;
                sheet2.width = pj.pageWidth/2;

                var sheets:Sprite = new Sprite();
                sheets.addChild(sheet1);
                sheets.addChild(sheet2);
                sheets.getChildAt(1).x = sheets.getChildAt(0).width;
                try {
                    pj.addPage(sheets);
                    pagesToPrint++;
                }
                catch(e:Error) {
                    // do nothing
                }

                if(pagesToPrint > 0) {
                    pj.send();
                }
            }
        }

        private function printTopHalf():void {
            var pj:PrintJob = new PrintJob();
            var pagesToPrint:uint = 0;
            if(pj.start()) {                
                if(pj.orientation == PrintJobOrientation.PORTRAIT) {
                    throw new Error("Without embedding fonts you must print the top half with an orientation of landscape.");
                }
                
                sheet1.height = pj.pageHeight;
                sheet1.width = pj.pageWidth/2;
                sheet2.height = pj.pageHeight;
                sheet2.width = pj.pageWidth/2;

                var sheets:Sprite = new Sprite();
                sheets.addChild(sheet1);
                sheets.addChild(sheet2);
                sheets.getChildAt(1).x = sheets.getChildAt(0).width;
                try {
                    pj.addPage(sheets, new Rectangle(0, 0, sheets.width, sheets.height/2));
                    pagesToPrint++;
                }
                catch(e:Error) {
                    // do nothing
                }

                if(pagesToPrint > 0) {
                    pj.send();
                }
            }
        }


        private function draw():void {
            var sheetWidth:Number = this.stage.stageWidth/2;
            var sheetHeight:Number = this.stage.stageHeight;
            
            addChild(sheet1);
            sheet1.width = sheetWidth;
            sheet1.height = sheetHeight;
            
            addChild(sheet2);
            sheet2.width = sheetWidth;
            sheet2.height = sheetHeight;
            sheet2.x = sheet1.width;
        }        
    }
}
PrintJobExample.2.as

次の例では、印刷の追加機能について説明します。この例では、PrintJob 設定の印刷部数、用紙サイズ(Legal)およびページの向き(横)を初期化します。最初にページ設定ダイアログを表示してから、印刷ダイアログを表示して印刷ジョブを開始します。
 
package 
 { 
     import flash.display.Sprite; 
     import flash.display.Stage; 
     import flash.geom.Rectangle; 
     import flash.printing.PaperSize; 
     import flash.printing.PrintJob; 
    import flash.printing.PrintJobOrientation; 
    import flash.printing.PrintUIOptions; 
    import flash.text.TextField; 
      
     public class PrintJobExample extends Sprite 
     { 
         private var bg:Sprite; 
         private var txt:TextField; 
        private var pj:PrintJob; 
        private var uiOpt:PrintUIOptions; 
  
         public function PrintJobExample():void 
         { 
            var pj = new PrintJob(); 
            uiOpt = new PrintUIOptions(); 
            initPrintJob(); 
             initContent(); 
             draw(); 
             printPage(); 
         } 
          
         private function printPage():void 
         { 
            if (pj.supportsPageSetupDialog) 
            { 
                pj.showPageSetupDialog(); 
            }
            
             if (pj.start2(uiOpt, true)) 
             { 
                   try 
                 { 
                     pj.addPage(this, new Rectangle(0, 0, 100, 100)); 
                 } 
                 catch (error:Error) 
                 { 
                     // Do nothing. 
                 } 
                 pj.send(); 
             } 
             else 
             { 
                 txt.text = "Print job terminated"; 
                pj.terminate(); 
             } 
         } 
         
         private function initContent():void 
         { 
             bg = new Sprite(); 
             bg.graphics.beginFill(0x00FF00); 
             bg.graphics.drawRect(0, 0, 100, 200); 
             bg.graphics.endFill(); 
              
             txt = new TextField(); 
             txt.border = true; 
             txt.text = "Hello World"; 
         } 
          
        private function initPrintJob():void 
        { 
            pj.setPaperSize(PaperSize.LEGAL); 
            pj.orientation = PrintJobOrientation.LANDSCAPE; 
            pj.copies = 2; 
            pj.jobName = "Flash test print";
        } 
         
         private function draw():void 
         { 
             addChild(bg); 
             addChild(txt); 
             txt.x = 50; 
             txt.y = 50; 
         } 
     } 
}




[ X ]英語で表示される理由
ActionScript 3.0 リファレンスガイドのコンテンツが英語で表示されます。

ActionScript 3.0 リファレンスガイドのすべての部分がすべての言語に翻訳されているわけではありません。言語エレメントが翻訳されていない場合、そのエレメントは英語で表示されます。例えば、ga.controls.HelpBox クラスはどの言語にも訳されていません。このため、リファレンスガイドの日本語バージョンでは、ga.controls.HelpBox クラスは英語で表示されます。