Skip to content

Commit 25076ea

Browse files
authored
Update pdf-endpoint.mdx
1 parent b5c1ff6 commit 25076ea

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/content/docs/browser-rendering/rest-api/pdf-endpoint.mdx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/pdf
1616
```
1717

1818
## Required Fields
19-
You must provider either `url` or `html`:
19+
You must provide either `url` or `html`:
2020
- `url` (string)
2121
- `html` (string)
2222

@@ -69,9 +69,9 @@ console.log(content);
6969

7070
</TabItem> </Tabs>
7171

72-
### Convert custom HTML to PDF
72+
### Convert Custom HTML to PDF
7373

74-
If you have HTML you'd like to generate a PDF from, the `html` option can be used. The option `addStyleTag` can be used to add custom styles.
74+
If you have raw HTML you'd like to generate a PDF from, use the `html` option. You can still apply custom styles using the `addStyleTag` parameter.
7575

7676
```bash
7777
curl -X POST https://api.cloudflare.com/client/v4/accounts/<acccountID>/browser-rendering/pdf \
@@ -89,9 +89,13 @@ curl -X POST https://api.cloudflare.com/client/v4/accounts/<acccountID>/browser-
8989

9090
## Advanced usage
9191

92-
Navigate to `https://example.com`, first setting an additional HTTP request header and configuring the page size (`viewport`). Then, wait until there are no more than 2 network connections for at least 500 ms, or until the maximum timeout of 4500 ms is reached, before considering the page loaded and returning the rendered PDF document.
92+
Many more options exist, such as setting HTTP credentials using `authenticate`, setting `cookies`, and customizing load behavior using `gotoOptions`. **Check the full endpoint [reference](/api/resources/browser_rendering/subresources/pdf/methods/create/) for all available parameters.**
9393

94-
The `goToOptions` parameter exposes most of [Puppeteer'd API](https://pptr.dev/api/puppeteer.gotooptions).
94+
### Advanced Page Load with Custom Headers and Viewport
95+
96+
Navigate to `https://example.com`, setting additional HTTP headers and configuring the page size (viewport). The PDF generation will wait until there are no more than 2 network connections for at least 500 ms, or until the maximum timeout of 4500 ms is reached, before rendering.
97+
98+
The `goToOptions` parameter exposes most of [Puppeteer's API](https://pptr.dev/api/puppeteer.gotooptions).
9599

96100
```bash
97101
curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/pdf' \
@@ -114,9 +118,9 @@ curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-
114118
--output "advanced-output.pdf"
115119
```
116120

117-
## Blocking images and styles when generating a PDF
121+
## Blocking Images and Styles when Generating a PDF
118122

119-
The options `rejectResourceTypes` and `rejectRequestPattern` can be used to block requests. The opposite can also be done, _only_ allow certain requests using `allowResourceTypes` and `allowRequestPattern`.
123+
The options `rejectResourceTypes` and `rejectRequestPattern` can be used to block requests during rendering. The opposite can also be done, _only_ allow certain requests using `allowResourceTypes` and `allowRequestPattern`.
120124

121125
```bash
122126
curl -X POST https://api.cloudflare.com/client/v4/accounts/<acccountID>/browser-rendering/pdf \
@@ -129,5 +133,3 @@ curl -X POST https://api.cloudflare.com/client/v4/accounts/<acccountID>/browser-
129133
}' \
130134
--output "cloudflare.pdf"
131135
```
132-
133-
Many more options exist, like setting HTTP credentials using `authenticate`, setting `cookies`, and using `gotoOptions` to control page load behaviour - check the endpoint [reference](/api/resources/browser_rendering/subresources/pdf/methods/create/) for all available parameters.

0 commit comments

Comments
 (0)