Skip to content

Commit

Permalink
Up docs (#1910)
Browse files Browse the repository at this point in the history
* Up docs

This gave me a real headache. On some html documents / pages pdf would be generated prematurely with no text.
Relates to puppeteer/puppeteer#422

* Update README.md

* Update README.md
  • Loading branch information
lofcz authored Feb 14, 2022
1 parent 893a4c8 commit f636e6c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ using var browserFetcher = new BrowserFetcher();
await browserFetcher.DownloadAsync();
await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions {Headless = true});
await using var page = await browser.NewPageAsync();
await page.GoToAsync("http://www.google.com");
await page.GoToAsync("http://www.google.com"); // In case of fonts being loaded from a CDN, use WaitUntilNavigation.Networkidle0 as a second param.
await page.EvaluateExpressionHandleAsync("document.fonts.ready"); // Wait for fonts to be loaded. Omitting this might result in no text rendered in pdf.
await page.PdfAsync(outputFile);
```
<sup><a href='/lib/PuppeteerSharp.Tests/PageTests/PdfTests.cs#L29-L38' title='Snippet source file'>snippet source</a> | <a href='#snippet-pdfasync' title='Start of snippet'>anchor</a></sup>
Expand Down

0 comments on commit f636e6c

Please sign in to comment.