This repository was archived by the owner on Dec 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathClass1.cs
More file actions
52 lines (50 loc) · 1.79 KB
/
Class1.cs
File metadata and controls
52 lines (50 loc) · 1.79 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System.Net.Http.Json;
using PdfApi.Shared;
namespace PdfApi.Client;
public static class Program
{
public static async Task Main(string[] args)
{
while (true)
{
try
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://104.210.129.44:5000");
var wk = await client.PostAsJsonAsync("/wk", new WkPdfRequest()
{
Url =
"https://painel.teorico.com.br/Classes/presenceData/2e337e88-7587-4a70-8adb-0a7b7988be80?key=pdfExportInternalOnlyChangeThisLater&offset=0",
FooterRight = "[page]/[toPage]",
FooterLeft = "[datetime]",
Replacements = new Dictionary<string, string>
{
{"datetime", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}
},
PageMargins = new Margins
{
Right = 4,
Left = 4
},
FooterSpacing = 3,
IsLowQuality = true,
NoOutline = true,
ImageDpi = 300,
DisableExternalLinks = true,
DisableInternalLinks = true,
ImageQuality = 80,
PrintMediaType = true,
Dpi = 70,
FooterLine = true
});
wk.EnsureSuccessStatusCode();
var content = await wk.Content.ReadAsByteArrayAsync();
File.WriteAllBytes("hello.pdf", content);
}
catch (Exception ex)
{
Console.WriteLine("Error");
}
}
}
}