How to get printers interface in NPAPI plugin for Google Chrome? - google-chrome

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?

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.

Related

How to detect if Google Cast extension is installed in Chrome?

I am developing a Google Cast sender application and on my web page in chrome browser, I need to detect if the Google Cast extension is installed or not before doing something.
I did some searching and found some suggestions for detecting chrome extensions if developer owns both website and extension. In my case, I am trying to detect an extension not developed by me. Is there an API or another way to detect installation of a third party chrome extension?
The standard way (used by the library itself) of detecting whether the extension is installed is to try and load a web-accessible file from it.
This, however, leads to an unwanted effect of producing error messages in the console (which are "network" errors and not JS errors, and therefore cannot be hidden) when Cast is not installed.
Also, you should not do this probing yourself, specifically because you don't control Google Cast - and it's not guaranteed to be stable in how it operates internally. There is a library you're expected to use as a Sender, and you should rely on the library initialization callback for detecting Cast.

Make a NPAPI plugin(made for firefox) run into chrome browser

I have a NPAPI plugin , running fine in firefox. Now i want to port it to chrome browser, means i want it to work in chrome also.
But i have learnt after browsing on internet and many links that chrome no longer supports NPAPI rather now it supports pepper API and now there is concept of native client.
What i have developed an understanding so far is that if i replace the NPAPI code(made for plugin for firefox) with the Pepper API code and upon compilation, a pexe file(native client module) along with manifest file(which is referring to the location of the pexe file) would be generated which would be kept on the server.
when an html page having embed tag describing a particular MIME type, say "application/x-pnacl" is loaded, then via src attribute(referring to the manifest file) of embed tag, manifest file is fetched which then fetches the actual pexe file which is then run by/within the native client plugin(already present in chrome).
I am not sure whether this understanding is correct or not. I was assuming that just like firefox plugin, pexe file would be stored and installed on local user PC and then detected/loaded by chrome as a plugin. Please tell whether this is correct or not.
Also, I want to ask whether still there exist any way to run NPAPI plugin in chrome or not. If it is please tell otherwise i should not think about it.
First, Chrome no longer supports NPAPI plugins for security reasons:
https://support.google.com/chrome/answer/6213033?hl=en
Plugins must use the Pepper Plugin API (PPAPI) and be compiled as Native Client (NaCl) executables so the plugin binary can be validated as safe to run. Portable Native Client (PNaCl) plugins can be loaded by any web page without the user installing anything. However, if your plugin is large, you may want to distribute it as a Web Application through the Chrome Web Store. In that case, you can bundle your .nexe's or a .pexe with your application so it is effectively installed on the user's machine.
This link describes how you can distribute your plugin:
https://developer.chrome.com/native-client/devguide/distributing

ithit ajaxbrowser prompting for NPAPI plugin on non-office documents when using chrome browser

We are using the latest ajaxbrowser that can now open office type documents without the soon to be unsupported npapi plug-in. We are however still seeing the issue with other file types. Is there a way to open other files without seeing the error message in chrome or is this being fixed soon?
I see that currently the best solution is to use other web browser to open non-MS Office documents via IT Hit NPAPI plugin.
I see that enabling NPAPI in Chrome is a temporary solution. According to Google after the release of Chrome version 45, we will have to use an alternatively web browser to load content that requires a NPAPI plugin ( https://support.google.com/chrome/answer/6213033?hl=en ).
Do you plan to create new IT Hit plugin (PPAPI) for Chrome?
To open non-MS Office documents you will need the Java applet. The Java applets use NPAPI that are disabled in Google Chrome by default. The only solution is to use other web browsers or enable NPAPI in Chrome.
This issue should be fixed since v1.9.1.1408
http://www.webdavsystem.com/ajax/download/release_history/

Chrome extension or chrome app?

I would like to create an extension or app for the Chrome browser which would require access to a user's Google Calender (for creating new appointments).
I am unsure of which technology to better research and use, Chrome extensions or apps. My "app" wouldn't need much of a GUI, so I'm leaning towards extension — but I don't know if this would pose any difficulties for accessing a user's Google Calender to add an event.
Anyone one have any idea which technology is best for this situation, and why? Thanks!
Either, or... Go with an extension if you'd like.
I assume you've looked at the API reference?
https://developers.google.com/google-apps/calendar/
From there, I'd imagine you'd just need OAuth to authenticate the user. Here's the JS library:
https://code.google.com/p/google-api-javascript-client/
There are pros/cons of each types, apps or extensions.
Apps
If you would like to create a client application of Google Calendar which has many rich GUI components, this type will become a better solution.
In addition, Chrome apps can communicate with many hardware devices and other servers. Of course, your Chrome app can become as a server (that is, your app can open a server socket and accept a request from other client apps).
Chrome apps can be executed not depending on your Chrome Web browser. That is, Chrome apps cannot access to a context of your Chrome Web browser.
Probably, you don't want to get the pros above, I guess...
Extensions
If you would like to create a small UI for posting your schedule to Google Calendar, this type will become a better solution.
In addition, Chrome extensions can access to a context of your Chrome Web browser. That is, your extension can get page contents of each tab and inject your CSS and/or JS code. For example, your extension will get a URL of some opened tab and include it in a body of the posted schedule.
Chrome extensions completely depend on your Chrome Web browser. That is, your extension cannot execute independently.
Also, generally, high cost will be needed to develop Chrome apps than Chrome extensions. As the result, you should choose Chrome extensions, I believe.

Chrome extension API to manipulate other installed Chrome extensions?

I'm writing a Google Chrome extension that needs to do a lot of things with other extensions, such as:
List installed extensions and read their IDs
Request extension installation, update and removal (preferably without bothering the user)
Modify extension settings
and so on. Which of these are possible, and which are not (due to e.g. security considerations)?
P.S. I haven't been able to find answers in the inter-extension messaging section of the official docs (or anywhere else, actually).
You can do most of those things today with chrome.management API. For example:
Get a list of information about installed extensions and apps:
chrome.management.getAll(function callback)
Uninstall a currently installed app or extension:
chrome.management.uninstall(string id, object options, function callback)
Chromium developer Brian Kennish states here suggests writing an NPAPI plugin as the most rational option to achieve the desired effect.
This is not directly possible via the extension API. To be honest, I wouldn't recommend using NPAPI for this either since you'd have to modify files which are in-use by the browser, which is unreliable at best.