diff --git a/api-samples/printing/README.md b/api-samples/printing/README.md index 70d6ca8264..701598a506 100644 --- a/api-samples/printing/README.md +++ b/api-samples/printing/README.md @@ -8,6 +8,8 @@ The `chrome.printing` namespace only works on ChromeOS. The sample demonstrates Calling `submitJob()` triggers a dialog box asking the user to confirm printing. Use the [`PrintingAPIExtensionsAllowlist`](https://chromeenterprise.google/policies/#PrintingAPIExtensionsAllowlist") policy to bypass confirmation. +If the **Roll Printers** checkbox is selected, only printers capable of roll printing will appear in the table. In this case, a separate test file is printed and the height of the media can be variable. See [`Roll printing`](https://developer.chrome.com/docs/extensions/reference/printing/#roll-printing) for more information. + ## Implementation Notes -Note that the `submitJob()` function throws an error when returning a promise ([crbug: 1422837](https://bugs.chromium.org/p/chromium/issues/detail?id=1422837)). +Before Chrome 120, `submitJob()` function throws an error when returning a promise. diff --git a/api-samples/printing/background.js b/api-samples/printing/background.js new file mode 100644 index 0000000000..aa9bb9acbc --- /dev/null +++ b/api-samples/printing/background.js @@ -0,0 +1,19 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +chrome.action.onClicked.addListener(() => { + chrome.tabs.create({ + url: 'printers.html' + }); +}); diff --git a/api-samples/printing/manifest.json b/api-samples/printing/manifest.json index 3fc75a98fa..3a38132acc 100644 --- a/api-samples/printing/manifest.json +++ b/api-samples/printing/manifest.json @@ -3,8 +3,10 @@ "version": "1.0", "description": "Demonstrates all four methods of the chrome.printing namespace.", "permissions": ["printing"], + "background": { + "service_worker": "background.js" + }, "action": { - "default_popup": "printers.html", "default_icon": { "16": "icons/icon16.png", "48": "icons/icon48.png", diff --git a/api-samples/printing/printers.html b/api-samples/printing/printers.html index 8bb03b9f89..46408898ec 100644 --- a/api-samples/printing/printers.html +++ b/api-samples/printing/printers.html @@ -28,11 +28,9 @@
JobId:
- -Default | Recently used | Capabilities | +Supports trim | Status |
---|