Changes

Jump to: navigation, search

NPAPI:Pepper

2,019 bytes removed, 15:41, 30 March 2010
Printing
The whole Pepper audio design document is too long to embed here.&nbsp; [[Plugins:PepperAudioAPI|Please click here for the Pepper Audio API]]<br>
 
= Printing =
 
Pepper modules can choose to export the Pepper printing interface. Today the interface is raster-oriented, but we plan to provide a vector interface in the future. To get the plugin print interface the browser can call the getPrintExtensions method on the extensions vector. This returns another vector of methods.
 
<pre>
/* Returns NULL if the plugin does not support print extensions */
typedef NPPPrintExtensions* (*NPPGetPrintExtensionsPtr)(NPP instance);
 
/* TBD: Provide a vector interface for printing. We need to decide
* on a vector format that can support embedded fonts. A vector format will
* greatly reduce the size of the required output buffer
*/
 
typedef struct _NPPPrintExtensions {
NPPPrintBeginPtr printBegin;
NPPGetRasterDimensionsPtr getRasterDimensions;
NPPPrintPageRasterPtr printPageRaster;
NPPPrintEndPtr printEnd;
} NPPPrintExtensions;
</pre>
 
To begin a print operation the browser calls the first method. This returns the total number of pages to print at the given printableArea size and DPI. printableArea is in points (a point is 1/72 of an inch). The plugin is expected to remember the values of printableArea and printerDPI for use in subsequent print interface calls. These values should be cleared by the printEnd method.
 
<pre>
typedef NPError (*NPPPrintBeginPtr) (
NPP instance,
NPRect* printableArea,
int32 printerDPI,
int32* numPages);
</pre>
 
The second method returns the required raster dimensions for the given page.
 
<pre>
typedef NPError (*NPPGetRasterDimensionsPtr) (
NPP instance,
int32 pageNumber,
int32* widthInPixels,
int32* heightInPixels);
</pre>
 
The third method rasterizes the specified page into a printSurface of the same format as used for the 2D device API.
 
<pre>
typedef NPError (*NPPPrintPageRasterPtr) (
NPP instance,
int32 pageNumber,
NPDeviceContext2D* printSurface);
</pre>
 
The last method ends the print operation.
 
<pre>
typedef NPError (*NPPPrintEndPtr) (NPP instance);
</pre>
= Clipboard =
89
edits

Navigation menu