public interface Printable
Printable
接口由当前页的画家的
print
方法实现,这是由印刷系统称为渲染页面。建立一个
Pageable
时,
PageFormat
实例和实例的实现此接口对用于描述每一页。该实例实现
Printable
叫做打印页面的图形。
一个Printable(..)
可设置在PrinterJob
。当客户端启动随后的印刷要求PrinterJob.print(..)
控制
将被递到打印系统,直到所有的页面都被打印出来。它通过调用Printable.print(..)
到文档中的所有页已打印。在使用Printable
接口印刷致力于图像的网页内容时,通过打印系统要求。
对Printable.print(..)
包括PageFormat
描述了页面的可打印区域的参数,计算的内容,将所需要的页面,和网页的索引,它指定零基础的打印流指标请求的页面。
为了正确的印刷行为,应遵守以下几点:
Printable.print(..)
页指标单调增加,尽管如上所说,这Printable
应该期待一页页指标指数和多个调用可以跳过,当页面范围由客户指定,或由用户通过打印对话框。Printable
必须检查和荣誉所提供的PageFormat参数以及页面索引。该页被吸引的格式是由PageFormat指定供应。的大小、方向和页面成像面积因此已经确定和绘制必须这种成像区域内。这是正确的打印行为的关键,它具有的含义是,客户端有跟踪什么内容属于指定的页面的责任。Printable
得到客户提供Pageable
然后客户可以为每个页面提供不同的PageFormats指数。页面休息的计算必须考虑到这一问题。Pageable
,
PageFormat
,
PrinterJob
Modifier and Type | Field and Description |
---|---|
static int |
NO_SUCH_PAGE
回到
print 表示
pageIndex 太大和所请求的页面不存在。
|
static int |
PAGE_EXISTS
回到
print(Graphics, PageFormat, int) 表示请求的网页渲染。
|
static final int PAGE_EXISTS
print(Graphics, PageFormat, int)
表示请求的网页渲染。
static final int NO_SUCH_PAGE
print
表示
pageIndex
太大和所请求的页面不存在。
int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
Graphics
上下文中指定的格式。一个
PrinterJob
调用
Printable
接口请求一个页面被渲染成指定的
graphics
语境。该页被吸引的格式指定的
pageFormat
。基于零的索引页面指定
pageIndex
。如果请求的页面不存在,则此方法返回no_such_page;否则返回page_exists。的
Graphics
类或其子类实现
PrinterGraphics
接口提供额外的信息。如果
Printable
对象中止打印作业然后抛出一个
PrinterException
。
graphics
-上下文的页面绘制
pageFormat
-页面的大小和方向绘制
pageIndex
-基于零的索引页被吸引
pageIndex
指定一个不存在的页面。
PrinterException
-当打印作业终止。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.