public IActionResult PlainPost([FromBody] HtmlSource htmlSource) //string htmlContent { // var myObject = JsonConvert.DeserializeObject<string>(htmlSource.Source); //return this.View("Plain",htmlSource); return(RedirectToAction(nameof(SaleIndex), new { htmlSource })); }
public IActionResult PdfSource([FromBody] HtmlSource htmlSource) //string htmlContent { //var converter = new BasicConverter(new PdfTools()); CustomAssemblyLoadContext context = new CustomAssemblyLoadContext(); context.LoadUnmanagedLibrary(@"C:\Users\stani\Desktop\storemanagementsystemweb\StoreSystem.Web\libwkhtmltox.dll"); var converter = new SynchronizedConverter(new PdfTools()); var doc = new HtmlToPdfDocument() { GlobalSettings = { ColorMode = ColorMode.Color, Orientation = Orientation.Portrait, PaperSize = PaperKind.A4, Margins = new MarginSettings() { Top = 10 }, Out = @"D:\test.pdf", }, Objects = { new ObjectSettings() { PagesCount = true, HtmlContent = htmlSource.Source, WebSettings = { DefaultEncoding = "utf-8" }, HeaderSettings ={ FontSize =9, Right = "Page [page] of [toPage]", Line = true, Spacing = 2.812 } } } }; converter.Convert(doc); return(StatusCode(200, "success")); }