You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3. Add your Browser Rendering binding to your new `wrangler.toml` configuration:
27
27
28
-
```yaml
28
+
```toml
29
29
browser = { binding = "BROWSER" }
30
30
```
31
31
@@ -66,15 +66,12 @@ export default {
66
66
Rather than using Browser Rendering to navigate to a user-provided URL, manually generate a webpage, then provide that webpage to the Browser Rendering instance. This allows you to render any design you want.
67
67
68
68
:::note
69
-
It's worth noting that you can generate your HTML or CSS using any method
70
-
you'd like. For now we're using string interpolation, but this method is
71
-
fully-compatible with web frameworks capable of rendering HTML on Workers such
72
-
as React, Remix, and Vue.
69
+
You can generate your HTML or CSS using any method you like. This example uses string interpolation, but this method is fully-compatible with web frameworks capable of rendering HTML on Workers such as React, Remix, and Vue.
73
70
:::
74
71
75
72
For this example, we're going to take in user-provided content (via a '?name=' parameter), and have that name output in the final PDF document.
76
73
77
-
To start, let's fill out your 'generateDocument' function with the following:
74
+
To start, fill out your `generateDocument` function with the following:
This example HTML document should render a beige background imitating a certificate showing that the user-provided name has successfully rendered a PDF using Cloudflare Workers.
129
126
130
127
:::note
131
-
It's usually best to avoid directly interpolating user-provided content into
132
-
an image or PDF renderer in production applications. To render contents like
133
-
an invoice, it wold be best to validate the data input, and fetch data
134
-
yourself using tools like [D1](/d1/) or
135
-
[Workers KV](/kv/).
128
+
It is usually best to avoid directly interpolating user-provided content into an image or PDF renderer in production applications. To render contents like an invoice, it wold be best to validate the data input, and fetch data yourself using tools like [D1](/d1/) or [Workers KV](/kv/).
Copy file name to clipboardExpand all lines: src/content/docs/browser-rendering/platform/puppeteer.mdx
+35-32Lines changed: 35 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ The Workers team forked a version of Puppeteer and patched it to connect to the
15
15
16
16
Our version is open sourced and can be found in [Cloudflare's fork of Puppeteer](https://github.com/cloudflare/puppeteer). The npm can be installed from [npmjs](https://www.npmjs.com/) as [@cloudflare/puppeteer](https://www.npmjs.com/package/@cloudflare/puppeteer):
17
17
18
-
```javascript
18
+
```bash
19
19
npm install @cloudflare/puppeteer --save-dev
20
20
```
21
21
@@ -83,18 +83,18 @@ In order to facilitate browser session management, we've added new methods to `p
83
83
84
84
`puppeteer.sessions()` lists the current running sessions. It will return an output similar to this:
0 commit comments