/// <summary> /// Instantiates a new /// <see cref="ConverterProperties"/> /// instance based on another /// <see cref="ConverterProperties"/> /// instance /// (copy constructor). /// </summary> /// <param name="other"> /// the other /// <see cref="ConverterProperties"/> /// instance /// </param> public ConverterProperties(iText.Html2pdf.ConverterProperties other) { this.mediaDeviceDescription = other.mediaDeviceDescription; this.fontProvider = other.fontProvider; this.tagWorkerFactory = other.tagWorkerFactory; this.cssApplierFactory = other.cssApplierFactory; this.baseUri = other.baseUri; this.createAcroForm = other.createAcroForm; this.outlineHandler = other.outlineHandler; this.charset = other.charset; this.metaInfo = other.metaInfo; }
public IActionResult Download(string id, string dataID, string type) { var entity = this.Manager.DynamicFormManager.Find(id, dataID); var html = this.Manager.DynamicFormManager.GetCompleteHtml(entity.Html, entity.Data, this.HostingEnvironment.WebRootPath); if (String.Equals("pdf", type, StringComparison.OrdinalIgnoreCase)) { var stream = new System.IO.MemoryStream(); var fontProvider = new iText.Html2pdf.Resolver.Font.DefaultFontProvider(true, true, true); var converterProperties = new iText.Html2pdf.ConverterProperties(); converterProperties.SetFontProvider(fontProvider); iText.Html2pdf.HtmlConverter.ConvertToPdf(html, stream, converterProperties); var bytes = stream.ToArray(); return(this.File(bytes, "application/pdf")); } return(this.Content(html, "text/html")); }