Skip to content

Commit e7f4ff4

Browse files
authored
Update readme for v0.1
1 parent 17574d5 commit e7f4ff4

File tree

1 file changed

+44
-3
lines changed

1 file changed

+44
-3
lines changed

README.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,48 @@
1-
# Introduction
1+
# Puppeteer Sharp
22

3-
This project is a .NET port of the official [Node.JS Puppeteer API](https://github.com/GoogleChrome/puppeteer).
4-
The first goal is to get a functional library with an API as close as the official one.
3+
[![NuGet](https://img.shields.io/nuget/v/PuppeteerSharp.svg?style=flat-square&label=nuget&colorB=green)](https://www.nuget.org/packages/PuppeteerSharp/)
4+
5+
Puppeteer Sharp is a .NET port of the official [Node.JS Puppeteer API](https://github.com/GoogleChrome/puppeteer).
6+
7+
# Usage
8+
9+
## Take screenshots
10+
11+
```
12+
await Downloader.CreateDefault().DownloadRevisionAsync(chromiumRevision);
13+
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
14+
{
15+
Headless = true
16+
}, chromiumRevision);
17+
var page = await browser.NewPageAsync();
18+
await page.GoToAsync("http://www.google.com");
19+
await page.ScreenshotAsync(outputFile));
20+
```
21+
22+
You can also change the view port before generating the screenshot
23+
24+
25+
```
26+
await page.SetViewport(new ViewPortOptions
27+
{
28+
Width = 500,
29+
Height = 500
30+
});
31+
```
32+
33+
34+
## Generate PDF files
35+
36+
```
37+
await Downloader.CreateDefault().DownloadRevisionAsync(chromiumRevision);
38+
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
39+
{
40+
Headless = true
41+
}, chromiumRevision);
42+
var page = await browser.NewPageAsync();
43+
await page.GoToAsync("http://www.google.com");
44+
await page.PdfAsync(outputFile));
45+
```
546

647
# Monthly reports
748

0 commit comments

Comments
 (0)