Created
November 19, 2019 14:47
-
-
Save piccaso/d5ab118fc412772fe963f59aacfc7080 to your computer and use it in GitHub Desktop.
using gotenberg from dot net (c#)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using var client = new HttpClient {BaseAddress = new Uri("https://localhost:3000/")}; | |
using var content = new MultipartFormDataContent { | |
{new StringContent(html), "files", "index.html"}, | |
{new StringContent("8.27"), "paperWidth"}, | |
{new StringContent("11.69"), "paperHeight"}, | |
{new StringContent("0"), "marginTop"}, | |
{new StringContent("0"), "marginBottom"}, | |
{new StringContent("0"), "marginLeft"}, | |
{new StringContent("0"), "marginRight"}, | |
{new StringContent("true"), "landscape"} | |
}; | |
using var response = await client.PostAsync("convert/html", content); | |
var pdfBytes = await response.Content.ReadAsByteArrayAsync(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment