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
Copy file name to clipboardExpand all lines: README.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,8 +49,8 @@ See [this document](https://github.com/hardkoded/puppeteer-sharp/blob/master/CON
49
49
50
50
## Take screenshots
51
51
52
-
<!-- snippet: ScreenshotAsync-->
53
-
<aid='snippet-ScreenshotAsync'></a>
52
+
<!-- snippet: screenshotasync_example-->
53
+
<aid='snippet-screenshotasync_example'></a>
54
54
```cs
55
55
varbrowserFetcher=newBrowserFetcher();
56
56
awaitbrowserFetcher.DownloadAsync();
@@ -60,27 +60,27 @@ await using var page = await browser.NewPageAsync();
60
60
awaitpage.GoToAsync("http://www.google.com");
61
61
awaitpage.ScreenshotAsync(outputFile);
62
62
```
63
-
<sup><ahref='https://github.com/hardkoded/puppeteer-sharp/blob/master/lib/PuppeteerSharp.Tests/ScreenshotTests/PageScreenshotTests.cs#L54-L62'title='Snippet source file'>snippet source</a> | <ahref='#snippet-ScreenshotAsync'title='Start of snippet'>anchor</a></sup>
63
+
<sup><ahref='https://github.com/hardkoded/puppeteer-sharp/blob/master/lib/PuppeteerSharp.Tests/ScreenshotTests/PageScreenshotTests.cs#L54-L62'title='Snippet source file'>snippet source</a> | <ahref='#snippet-screenshotasync_example'title='Start of snippet'>anchor</a></sup>
64
64
<!-- endSnippet -->
65
65
66
66
You can also change the view port before generating the screenshot
67
67
68
-
<!-- snippet: SetViewportAsync-->
69
-
<aid='snippet-SetViewportAsync'></a>
68
+
<!-- snippet: setviewportasync_example-->
69
+
<aid='snippet-setviewportasync_example'></a>
70
70
```cs
71
71
awaitPage.SetViewportAsync(newViewPortOptions
72
72
{
73
73
Width=500,
74
74
Height=500
75
75
});
76
76
```
77
-
<sup><ahref='https://github.com/hardkoded/puppeteer-sharp/blob/master/lib/PuppeteerSharp.Tests/ScreenshotTests/ElementHandleScreenshotTests.cs#L13-L19'title='Snippet source file'>snippet source</a> | <ahref='#snippet-SetViewportAsync'title='Start of snippet'>anchor</a></sup>
77
+
<sup><ahref='https://github.com/hardkoded/puppeteer-sharp/blob/master/lib/PuppeteerSharp.Tests/ScreenshotTests/ElementHandleScreenshotTests.cs#L13-L19'title='Snippet source file'>snippet source</a> | <ahref='#snippet-setviewportasync_example'title='Start of snippet'>anchor</a></sup>
78
78
<!-- endSnippet -->
79
79
80
80
### Generate PDF files
81
81
82
-
<!-- snippet: PdfAsync-->
83
-
<aid='snippet-PdfAsync'></a>
82
+
<!-- snippet: pdfasync_example-->
83
+
<aid='snippet-pdfasync_example'></a>
84
84
```cs
85
85
varbrowserFetcher=newBrowserFetcher();
86
86
awaitbrowserFetcher.DownloadAsync();
@@ -90,32 +90,32 @@ await page.GoToAsync("http://www.google.com"); // In case of fonts being loaded
90
90
awaitpage.EvaluateExpressionHandleAsync("document.fonts.ready"); // Wait for fonts to be loaded. Omitting this might result in no text rendered in pdf.
91
91
awaitpage.PdfAsync(outputFile);
92
92
```
93
-
<sup><ahref='https://github.com/hardkoded/puppeteer-sharp/blob/master/lib/PuppeteerSharp.Tests/PageTests/PdfTests.cs#L23-L33'title='Snippet source file'>snippet source</a> | <ahref='#snippet-PdfAsync'title='Start of snippet'>anchor</a></sup>
93
+
<sup><ahref='https://github.com/hardkoded/puppeteer-sharp/blob/master/lib/PuppeteerSharp.Tests/PageTests/PdfTests.cs#L23-L33'title='Snippet source file'>snippet source</a> | <ahref='#snippet-pdfasync_example'title='Start of snippet'>anchor</a></sup>
0 commit comments