File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,31 @@ await page.GoToAsync("http://www.google.com");
4242await page .PdfAsync (outputFile );
4343```
4444
45+ ### Generate PDF files with custom options
46+
47+ ``` cs
48+ await new BrowserFetcher ().DownloadAsync (BrowserFetcher .DefaultRevision );
49+ var browser = await Puppeteer .LaunchAsync (new LaunchOptions
50+ {
51+ Headless = true
52+ });
53+ var page = await browser .NewPageAsync ();
54+ await page .GoToAsync (" http://www.google.com" );
55+ await page .PdfAsync (outputFile , new PdfOptions
56+ {
57+ Format = PaperFormat .A4 ,
58+ DisplayHeaderFooter = true ,
59+ MarginOptions = new MarginOptions
60+ {
61+ Top = " 20px" ,
62+ Right = " 20px" ,
63+ Bottom = " 40px" ,
64+ Left = " 20px"
65+ },
66+ FooterTemplate = " <div id=\" footer-template\" style=\" font-size:10px !important; color:#808080; padding-left:10px\" >Footer Text</div>"
67+ });
68+ ```
69+
4570## Inject HTML
4671
4772``` cs
Original file line number Diff line number Diff line change @@ -21,6 +21,6 @@ Puppeteer Sharp is a .NET port of the official [Node.JS Puppeteer API](https://g
2121
2222# Useful links
2323
24- * Slack channel [ #puppeteer-sharp] ( https://join .slack.com/t/puppeteer/ shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc )
24+ * Slack channel [ #puppeteer-sharp] ( https://puppeteer .slack.com/join/ shared_invite/enQtMzU4MjIyMDA5NTM4LWI0YTE0MjM0NWQzYmE2MTRmNjM1ZTBkN2MxNmJmNTIwNTJjMmFhOWFjMGExMDViYjk2YjU2ZmYzMmE1NmExYzc )
2525* [ StackOverflow] ( https://stackoverflow.com/search?q=puppeteer-sharp )
2626* [ Issues] ( https://github.com/kblok/puppeteer-sharp/issues?utf8=%E2%9C%93&q=is%3Aissue )
You can’t perform that action at this time.
0 commit comments