From 3356f6a674b85000b7fd1797b0a60ea32e72ca7d Mon Sep 17 00:00:00 2001 From: dprevoznik <58714078+dprevoznik@users.noreply.github.com> Date: Mon, 17 Aug 2026 19:36:46 +0000 Subject: [PATCH 1/2] Add print-to-PDF example to Chrome policies doc Documents PrintingEnabled and PrintPdfAsImageDefault as the policies needed for reliable print-to-PDF via CDP/Playwright. --- browsers/chrome-policies.mdx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/browsers/chrome-policies.mdx b/browsers/chrome-policies.mdx index f9719da..f78cdc8 100644 --- a/browsers/chrome-policies.mdx +++ b/browsers/chrome-policies.mdx @@ -304,6 +304,38 @@ const browser = await kernel.browsers.create({ ``` +### Print to PDF + +`PrintingEnabled` must stay `true` (the default) for the browser's print-to-PDF path — including CDP's `Page.printToPDF` and Playwright's `page.pdf()` — to work. Add `PrintPdfAsImageDefault: true` to render each page as an image before conversion, which produces more consistent output on pages with complex CSS or canvas content. + + +```python Python +from kernel import Kernel + +kernel = Kernel() + +browser = kernel.browsers.create( + chrome_policy={ + "PrintingEnabled": True, + "PrintPdfAsImageDefault": True, + } +) +``` + +```typescript Typescript/Javascript +import Kernel from '@onkernel/sdk'; + +const kernel = new Kernel(); + +const browser = await kernel.browsers.create({ + chrome_policy: { + PrintingEnabled: true, + PrintPdfAsImageDefault: true, + }, +}); +``` + + ## Available policies Any policy listed in the [Chrome Enterprise policy documentation](https://chromeenterprise.google/policies/) can be used in the `chrome_policy` object. Refer to the official docs for the full list of supported policy names, types, and values. From 9ad54fe92025c407da9455147939a30fd9045e61 Mon Sep 17 00:00:00 2001 From: dprevoznik <58714078+dprevoznik@users.noreply.github.com> Date: Mon, 17 Aug 2026 19:55:03 +0000 Subject: [PATCH 2/2] Set PrintPdfAsImageDefault to false explicitly in example Recommends the extraction-friendly default and documents the tradeoff against image-based (true) output. --- browsers/chrome-policies.mdx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/browsers/chrome-policies.mdx b/browsers/chrome-policies.mdx index f78cdc8..8bee12c 100644 --- a/browsers/chrome-policies.mdx +++ b/browsers/chrome-policies.mdx @@ -306,7 +306,12 @@ const browser = await kernel.browsers.create({ ### Print to PDF -`PrintingEnabled` must stay `true` (the default) for the browser's print-to-PDF path — including CDP's `Page.printToPDF` and Playwright's `page.pdf()` — to work. Add `PrintPdfAsImageDefault: true` to render each page as an image before conversion, which produces more consistent output on pages with complex CSS or canvas content. +`PrintingEnabled` must stay `true` (the default) for the browser's print-to-PDF path — including CDP's `Page.printToPDF` and Playwright's `page.pdf()` — to work. + +`PrintPdfAsImageDefault` controls whether each page is rasterized to an image before being placed in the PDF, rather than kept as native vector text and graphics: + +- `false` (shown explicitly below, and Chrome's default) — keeps text selectable and extractable in the output PDF. Use this if automation will read the PDF's contents afterward (text extraction, parsing, LLM ingestion) — image-based PDFs need OCR to get text back out. +- `true` — rasterizes every page, which can look more consistent on pages with complex CSS or canvas content, at the cost of searchable text and a larger file. ```python Python @@ -317,7 +322,7 @@ kernel = Kernel() browser = kernel.browsers.create( chrome_policy={ "PrintingEnabled": True, - "PrintPdfAsImageDefault": True, + "PrintPdfAsImageDefault": False, } ) ``` @@ -330,7 +335,7 @@ const kernel = new Kernel(); const browser = await kernel.browsers.create({ chrome_policy: { PrintingEnabled: true, - PrintPdfAsImageDefault: true, + PrintPdfAsImageDefault: false, }, }); ```