public static class

PSPrinterJob.PluginPrinter

extends Object
implements Printable
java.lang.Object
   ↳ sun.print.PSPrinterJob.PluginPrinter

Class Overview

PluginPrinter generates EPSF wrapped with a header and trailer comment. This conforms to the new requirements of Mozilla 1.7 and FireFox 1.5 and later. Earlier versions of these browsers did not support plugin printing in the general sense (not just Java). A notable limitation of these browsers is that they handle plugins which would span page boundaries by scaling plugin content to fit on a single page. This means white space is left at the bottom of the previous page and its impossible to print these cases as they appear on the web page. This is contrast to how the same browsers behave on Windows where it renders as on-screen. Cases where the content fits on a single page do work fine, and they are the majority of cases. The scaling that the browser specifies to make the plugin content fit when it is larger than a single page can hold is non-uniform. It scales the axis in which the content is too large just enough to ensure it fits. For content which is extremely long this could lead to noticeable distortion. However that is probably rare enough that its not worth compensating for that here, but we can revisit that if needed, and compensate by making the scale for the other axis the same.

Summary

[Expand]
Inherited Constants
From interface java.awt.print.Printable
Public Constructors
PSPrinterJob.PluginPrinter(Component applet, PrintStream stream, int x, int y, int w, int h)
This is called from the Java Plug-in to print an Applet's contents as EPS to a postscript stream provided by the browser.
Public Methods
int print(Graphics g, PageFormat pf, int pgIndex)
Prints the page at the specified index into the specified Graphics context in the specified format.
void printAll()
void printPluginApplet()
void printPluginPSHeader()
void printPluginPSTrailer()
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.awt.print.Printable

Public Constructors

public PSPrinterJob.PluginPrinter (Component applet, PrintStream stream, int x, int y, int w, int h)

This is called from the Java Plug-in to print an Applet's contents as EPS to a postscript stream provided by the browser.

Parameters
applet the applet component to print.
stream the print stream provided by the plug-in
x the x location of the applet panel in the browser window
y the y location of the applet panel in the browser window
w the width of the applet panel in the browser window
h the width of the applet panel in the browser window

Public Methods

public int print (Graphics g, PageFormat pf, int pgIndex)

Prints the page at the specified index into the specified Graphics context in the specified format. A PrinterJob calls the Printable interface to request that a page be rendered into the context specified by graphics. The format of the page to be drawn is specified by pageFormat. The zero based index of the requested page is specified by pageIndex. If the requested page does not exist then this method returns NO_SUCH_PAGE; otherwise PAGE_EXISTS is returned. The Graphics class or subclass implements the PrinterGraphics interface to provide additional information. If the Printable object aborts the print job then it throws a PrinterException.

Parameters
g the context into which the page is drawn
pf the size and orientation of the page being drawn
pgIndex the zero based index of the page to be drawn
Returns
  • PAGE_EXISTS if the page is rendered successfully or NO_SUCH_PAGE if pageIndex specifies a non-existent page.

public void printAll ()

public void printPluginApplet ()

public void printPluginPSHeader ()

public void printPluginPSTrailer ()