0

how to receive printer interface in NPAPI plug-in for Google Chrome? I had a difficulty in writing of a plug-in of NPAPI. I can't understand. How to receive the list of all printers and to receive the interface to one of them?

I write Scripting plugins with use of documentation of https://developer.mozilla.org/en-US/docs/Gecko_Plugin_API_Reference/Scripting_plugins . but I didn't find the answer in this documentation there on the question.

I need to get access to the printer and to set to it settings in a plug-in. How it to make?

Crusnik
  • 1
  • 2
  • I'm not sure I agree with the decision to close this question, but let me suggest some places to start looking: http://npapi.com/tutorial, http://npapi.com/tutorial2, http://npapi.com/tutorial3, http://npapi.com/memory. Note that getting a list of printers is an OS thing and has nothing to do with whether it's in a plugin or not. Gecko Plugin API? I have no idea what you're talking about there; you npapi-sdk (google it). Even smarter, use http://firebreath.org – taxilian Oct 30 '12 at 15:14
  • i want to get printer in NPAPI plugin from google chrome. To receive flowing settings of the printer and put my settings. Print file. After the print to return settings which were. – Crusnik Oct 30 '12 at 16:55
  • There is no interface for doing that with NPAPI. You'd have to find a way to do it either with an extension or with OS API calls – taxilian Oct 30 '12 at 17:33

1 Answers1

1

What you are trying to do cannot be done directly with NPAPI. There is no interface in NPAPI for getting a list of printers -- in fact, NPAPI is completely unaware of the fact that there is a browser that may have settings. All an NPAPI plugin knows about is the page that it has been inserted into and/or the stream for the file that it is handling.

The only thing an NPAPI plugin can do regarding printing is respond to a NPP_Print call, which the browser calls once the user decides to print a page. When that is called, all the plugin receives is a context that it can draw into that will then be printed -- no info about available printers, print settings, etc.

For more information on what an NPAPI plugin is and is not, see http://npapi.com/extensions

What you're trying to do might be possible to do using either system API calls (windows API, mac API, etc) or using an extension. Extensions are completely browser-specific, so you'd have to look at each individual browser that you want to support to see if what you want to do can be done.

taxilian
  • 14,229
  • 4
  • 34
  • 73