-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClientPdf.cs
32 lines (27 loc) · 1.03 KB
/
ClientPdf.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Net;
using System.Collections.Generic;
class ClientPdf
{
static void Main(string[] args)
{
string customerKey = "PUT_YOUR_CUSTOMER_KEY_HERE";
string secretPhrase = ""; //leave secret phrase empty, if not needed
var options = new Dictionary<string, string>();
// mandatory parameter
options.Add("url", "https://www.google.com");
// all next parameters are optional, see our website to PDF API guide for more details
options.Add("paper", "letter");
options.Add("orientation", "portrait");
options.Add("media", "print");
options.Add("bg", "nobg");
options.Add("delay", "2000");
options.Add("scale", "50");
ScreenshotMachine sm = new ScreenshotMachine(customerKey, secretPhrase);
string pdfApiUrl = sm.GeneratePdfApiUrl(options);
//save PDF file
string output = "output.pdf";
new WebClient().DownloadFile(pdfApiUrl, output);
Console.Write("Pdf saved as " + output);
}
}