Hi Team,
1.I want to load css file when import css file(bootstrap) and then export to a pdf file, but I find I lost all the css style, my code is below, did I miss something?
Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider htmlProvider
= new Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider();
// Create a document instance from the content.
HtmlImportSettings importSettings = new HtmlImportSettings();
importSettings.LoadImageFromUri += (s, e) =>
{
// Load the data representing the resource
SystemNet.WebClient webClient = new SystemNet.WebClient();
byte[] data = webClient.DownloadData(e.Uri);
// Pass the loaded data to the arguments
string extension = SystemIO.Path.GetExtension(e.Uri).Substring(1); // Get the extension without the dot
e.SetImageInfo(data, extension);
};
importSettings.LoadStyleSheetFromUri += (s, e) =>
{
string styles = fs.File.ReadAllText(Server.MapPath("~") + e.Uri);
e.SetStyleSheetContent(styles);
};
htmlProvider.ImportSettings = importSettings;
htmlProvider.ImportSettings.DefaultStyleSheet = string.Empty;
RadFlowDocument document = htmlProvider.Import(htmlStr);
Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider pdfProvider
= new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
// Export the document. The different overloads enables you to export to a byte[] or to a Stream.
byte[] pdfBytes = pdfProvider.Export(document);
2. Can I use the code like below to set the default style to empty?
htmlProvider.ImportSettings.DefaultStyleSheet = string.Empty;
'