Skip to content

Commit e31c9ad

Browse files
links fix
1 parent eff3d93 commit e31c9ad

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/content/docs/browser-rendering/how-to/pdf-generation.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar:
77

88
import { Aside, WranglerConfig } from "~/components";
99

10-
As seen in the [Getting Started guide](/browser-rendering/get-started/screenshots/), Browser Rendering can be used to generate screenshots for any given URL. Alongside screenshots, you can also generate full PDF documents for a given webpage, and can also provide the webpage markup and style ourselves.
10+
As seen in the [Getting Started guide](/browser-rendering/workers-binding-api/screenshots/), Browser Rendering can be used to generate screenshots for any given URL. Alongside screenshots, you can also generate full PDF documents for a given webpage, and can also provide the webpage markup and style ourselves.
1111

1212
## Prerequisites
1313

@@ -26,9 +26,8 @@ npm install @cloudflare/puppeteer --save-dev
2626
3. Add your Browser Rendering binding to your new Wrangler configuration:
2727

2828
<WranglerConfig>
29-
```toml
30-
browser = { binding = "BROWSER" }
31-
```
29+
```toml browser = {(binding = "BROWSER")}
30+
```
3231
</WranglerConfig>
3332

3433
4. Replace the contents of `src/index.ts` (or `src/index.js` for JavaScript projects) with the following skeleton script:

src/content/docs/browser-rendering/platform/puppeteer.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ This script [launches](https://pptr.dev/api/puppeteer.puppeteernode.launch) the
6767

6868
### Keep Alive
6969

70-
If users omit the `browser.close()` statement, it will stay open, ready to be connected to again and [re-used](/browser-rendering/get-started/reuse-sessions/) but it will, by default, close automatically after 1 minute of inactivity. Users can optionally extend this idle time up to 10 minutes, by using the `keep_alive` option, set in milliseconds:
70+
If users omit the `browser.close()` statement, it will stay open, ready to be connected to again and [re-used](/browser-rendering/workers-binding-api/reuse-sessions/) but it will, by default, close automatically after 1 minute of inactivity. Users can optionally extend this idle time up to 10 minutes, by using the `keep_alive` option, set in milliseconds:
7171

7272
```js
7373
const browser = await puppeteer.launch(env.MYBROWSER, { keep_alive: 600000 });

src/content/docs/browser-rendering/workers-binding-api/reuse-sessions.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar:
77

88
import { Render, PackageManagers, WranglerConfig } from "~/components";
99

10-
The best way to improve the performance of your browser rendering worker is to reuse sessions. One way to do that is via [Durable Objects](/browser-rendering/get-started/browser-rendering-with-do/), which allows you to keep a long running connection from a worker to a browser. Another way is to keep the browser open after you've finished with it, and connect to that session each time you have a new request.
10+
The best way to improve the performance of your browser rendering worker is to reuse sessions. One way to do that is via [Durable Objects](/browser-rendering/workers-binding-api/browser-rendering-with-do/), which allows you to keep a long running connection from a worker to a browser. Another way is to keep the browser open after you've finished with it, and connect to that session each time you have a new request.
1111

1212
In short, this entails using `browser.disconnect()` instead of `browser.close()`, and, if there are available sessions, using `puppeteer.connect(env.MY_BROWSER, sessionID)` instead of launching a new browser session.
1313

@@ -51,7 +51,8 @@ compatibility_date = "2023-03-14"
5151
compatibility_flags = [ "nodejs_compat" ]
5252

5353
browser = { binding = "MYBROWSER" }
54-
```
54+
55+
````
5556
</WranglerConfig>
5657

5758
## 4. Code
@@ -133,7 +134,7 @@ export default {
133134
return sessionId!;
134135
},
135136
};
136-
```
137+
````
137138

138139
Besides `puppeteer.sessions()`, we've added other methods to facilitate [Session Management](/browser-rendering/platform/puppeteer/#session-management).
139140

0 commit comments

Comments
 (0)