private async Task <byte[]> GetPDF(byte[] file, string id) { byte[] ret = null; string baseUrl = _configuration["baseUrl"]; string inputFilename = @"wwwroot/pdf-template/cert.html"; string imgsrc = $"data:image/png;base64,{QR.GetPureBase64($"{baseUrl}/Contract/Certificate?id={id}")}"; HtmlDto dto = new HtmlDto() { html = System.Web.HttpUtility.HtmlEncode( Encoding.UTF8.GetString( System.IO.File.ReadAllBytes(inputFilename))) .Replace("{certificateid}", id) .Replace("{qrlink}", imgsrc), footerPath = $"{baseUrl}/pdf-template/footer.html" }; string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(dto); string uri = _configuration["pdfApi"]; var content = new StringContent(jsonString, Encoding.UTF8, "application/json"); var response = await client.PostAsync($"{uri}", content).ConfigureAwait(false); var file2 = await response.Content.ReadAsByteArrayAsync(); ret = Concat.DoConcat(file, file2); return(ret); }