NPP - MDC. Summary Represents a single instance of a plug-in. You specify one of these to any NPAPI function that needs to know which plug-in to work with. Syntax typedef struct _NPP { void* pdata; /* plug-in private data */ void* ndata; /* Mozilla private data */ } NPP_t; typedef NPP_t* NPP; Fields The data structure has the following fields: pdata A value, whose definition is up to the plug-in, that the plug-in can use to store a pointer to an internal data structure associated with the instance; this field isn't modified by the browser. ndata A private value, owned by the browser, which is used to store data associated with the instance; this value should not be modified by the plug-in.
Description Gecko creates an NPP structure for each plug-in instance and passes a pointer to it to NPP_New(). The NPP_Destroy() function informs the plug-in when the NPP instance is about to be deleted; after this call returns, the NPP pointer is no longer valid. See also Document Tags and Contributors. NPWindow - MDC. « Gecko Plugin API Reference « Plug-in Side Plug-in API Summary Contains information about the target into which the plug-in instance can draw. Syntax typedef struct _NPWindow { void* window; /* Platform specific handle */ uint32_t x; /* Coordinates of top left corner */ uint32_t y; /* relative to a Netscape page */ uint32_t width; /* Maximum window size */ uint32_t height; NPRect clipRect; /* Clipping rectangle coordinates */ #ifdef XP_UNIX void * ws_info; /* Platform-dependent additional data */ #endif /* XP_UNIX */ NPWindowType type; /* Window or drawable target */ } NPWindow; Fields The data structure has the following fields: window Platform-specific handle to a native window element in the Netscape window hierarchy on Windows (HWND) and Unix (X Window ID).
X, y The x and y coordinates for the top left corner of the plug-in relative to the page (and thus relative to the origin of the drawable). Height, width The height and width of the plug-in area. ClipRect ws_info type Description See Also. NPP_HandleEvent - MDC. « Gecko Plugin API Reference « Plug-in Side Plug-in API Summary Delivers a platform-specific window event to the instance. For Windowed Plug-ins: Currently used only on Mac OS. For Windowless Plug-ins: All platforms. Syntax #include <npapi.h> int16 NPP_HandleEvent(NPP instance, void* event); Parameters The function has the following parameters: instance Pointer to the current plug-in instance. event Platform-specific value representing the event handled by the function.
For a list of possible events, see NPEvent. Returns If the plug-in handles the event, the function should return true. Description The browser calls NPP_HandleEvent to tell the plug-in when events take place in the plug-in's window or drawable area. MS Windows The browser gives each windowed plug-in its own native window, often a child window of the browser window, to draw into.
Mac OS The browser does not give a windowed plug-in a native window, because the Mac OS platform does not support child windows. See Also NPEvent. NPP_Print - MDC. « Gecko Plugin API Reference « Plug-in Side Plug-in API Summary Requests a platform-specific print operation for an embedded or full-screen plug-in.
Syntax #include <npapi.h> void NPP_Print(NPP instance, NPPrint* PrintInfo); Parameters The function has the following parameters: instance Pointer to the current plug-in instance. PrintInfo Pointer to NPPrint structure. Description NPP_Print is called when the user requests printing for a web page that contains a visible plug-in (either embedded or full-page). An embedded plug-in shares printing with the browser; the plug-in prints the part of the page it occupies, and the browser handles everything else, including displaying print dialog boxes, getting the printer device context, and any other tasks involved in printing, as well as printing the rest of the page.
For information about printing on your platform, see your platform documentation. MS Windows On MS Windows printInfo->print.embedPrint.platformPrint is the device context (DC) handle. See Also. NPFullPrint - MDC. « Gecko Plugin API Reference « Plug-in Side Plug-in API Summary Substructure of NPPrint that contains platform-specific information used during full-page mode printing.
Syntax Fields The data structure has the following fields: pluginPrinted Determines whether the plug-in prints in full-page mode. PrintOne Not currently in use. PlatformPrint Platform-specific printing information. Description The NPP_Print function passes the plug-in a pointer to an NPPrint object (previously allocated by the browser).
The pluginPrinted field of this structure determines whether the plug-in prints in full-page mode or not. If you want an embedded plug-in to simply render its area of the page, set pluginPrinted to false and return immediately; the browser calls NPP_Print again with the NPEmbedPrint substructure of NPPrint. See Also NPP_Print, NPPrint, NPEmbedPrint Contributors to this page:Pmash. NPEmbedPrint - MDC. NPPrint - MDC. « Gecko Plugin API Reference « Plug-in Side Plug-in API Summary Contains information the plug-in needs to print itself in full-page or embedded mode. Syntax typedef struct _NPPrint { uint16 mode; /* NP_FULL or NP_EMBED */ union { NPFullPrint fullPrint; /* if mode is NP_FULL */ NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ } print; } NPPrint; Fields The data structure has the following fields: mode Determines whether plug-in prints in full-page or embedded mode.
Description The NPP_Print function passes a pointer to an NPPrint object (previously allocated by the browser) to the plug-in. See Also NPP_Print, NPFullPrint, NPEmbedPrint. NPPrintCallbackStruct - MDC. « Gecko Plugin API Reference « Plug-in Side Plug-in API Summary Contains information required by the platformPrint field of the NPEmbedPrint structure during embedded mode printing on Unix systems. This structure is only used on Unix. Syntax typedef struct { int32 type; FILE* fp; } NPPrintCallbackStruct; Fields The data structure has the following fields: type Always contains NP_PRINT. fp Pointer to the file to which the plug-in should write its PostScript data. Description Callback structures are used to pass platform-specific information.
At the time the plug-in is called, the browser has already opened the file and written PostScript for other parts of the page. See Also NPP_Print, NPEmbedPrint, NPSetWindowCallbackStruct, NPAnyCallbackStruct. HELP with Javascript!! Capturing Web Page from Firefox • mozilla. The observer watches for certain events on the calling element (in this case the Save button) such as onDrop and onDragOver. The observer calls SavePage (which just calls saveURL after checking if the page can be saved) to open the save dialog box when the onDrop event of the button gets triggered.
When the button is clicked, saveDocument (an internal Firefox function) is called instead, but it does the same thing. I could have used SavePage but decided to use the internally defined routine, to ensure that clicking on the button does exactly the same thing as clicking File > Save Page As on the menu or pressing Ctrl+S on the keyboard.
On the other hand, the file.save() function I have in common.js is not currently used in the extension. I formerly used it to silently download a page and open it in an editor when Edit button is clicked. Get image data in Javascript. Drawing Graphics with Canvas - MDC. Most of this content (but not the documentation on drawWindow) has been rolled into the more expansive Canvas tutorial, this page should probably be redirected there as it's now redundant but some information may still be relevant. Introduction With Firefox 1.5, Firefox includes a new HTML element for programmable graphics. <canvas> is based on the WHATWG canvas specification, which itself is based on Apple's <canvas> implemented in Safari.
It can be used for rendering graphs, UI elements, and other custom graphics on the client. <canvas> creates a fixed size drawing surface that exposes one or more rendering contexts. The 2D Rendering Context A Simple Example To start off, here's a simple example that draws two intersecting rectangles, one of which has alpha transparency: function draw() { var ctx = document.getElementById('canvas').getContext('2d'); ctx.fillStyle = "rgb(200,0,0)"; ctx.fillRect (10, 10, 55, 50); ctx.fillStyle = "rgba(0, 0, 200, 0.5)"; ctx.fillRect (30, 30, 55, 50);} draw(); How to Capture a Website Screenshot in Linux. You might be wondering how to capture a website screenshot (as thumbnail) but you dont know how to do it. Although PHP GD library is available, it is just not possible to do the task with php. You will need a linux server running xwindow system and a browser like KDE konquerer or firefox. In this tutorial i am going to show you how to capture a website screenshot with khtml2png in a Centos/RHEL server.
I am documenting here the experiment i conducted in my VPS so that my work could be helpful. What is Needed? Screenshot Capturing Basics Most linux servers will usually not have a graphics card or output device like monitor. First install Xvfb server and ImageMagick yum install Xvfb ImageMagick then, yum install firefox start the virtual display > Xvfb :2 -screen 0 1024x768x24& // This starts the virtual server with display no 2, screen no 1 on resolution 1024x768 with color depth of 24 bit. Run the firefox on the virtual display in the command line > DISPLAY=:2 firefox then . Take a screenshot of X display from SSH. Java 2 Platform SE v1.3.1: Class Robot.