I'm using OpenHtmlToPdf to convert a html file to a pdf file. This works, but it doesn't support css grid and also doesn't render the svg which is embedded in the html file.
Do you have an idea of how fix this or know any alternative libraries which support svgs and css grid?
Best regards
Related
I have built several PDF documents dynamically from ASP.NET pages (HTML/CSS) using plugins like Winnovative HtmlToPDFconverter. It has always been a successful outcome using the built-in functionality for those plugins, like merging existing PDF documents with dynamic content and adding pre-defined headers and footers, adding page margins, page numbers and so forth. The HTML content has overall been rendered as expected in the final PDF document(s).
Is there any way/any advice for a similar .NET plugin that can render HTML/CSHTML to a Microsoft Word document (.docx) in the same way – or is it too difficult to render native HTML5 and CSS into a desirable layout for a Microsoft Word Document?
I have googled around and found some suggestions, but I'm looking for recommendations for maybe a specific plugin – or a warning if it is a no-go
and too difficult to get the desired layout 1:1 from HTML to a Word document because of incompatibility between markups?
Devexpress HTML editor can export its HTML content to different formats including docx and rtf. Not sure about its limitations (e.g. script and canvas export, etc.), but in the common case it works well.
I'm running into a problem that I can't seem to figure out. The scenario is:
Download a bunch of text data as an HTML string
Use an HTML-to-Xaml converter to parse the HTML string and create a List<Block> (Windows.UI.Xaml.Documents.Block).
Display the collection of Blocks as a RichTextBlock control that's available in WinRT.
All of that works well. The problem is, I want to export this data as either a doc/docx or pdf file. Is there a way to export either the RichTextBlock directly or add these Blocks to a RichEditBox or even use the original HTML string to export to the file?
I looked at the Syncfusion Essential Studio, that offers the RichTextBoxAdv control, that's used as:
xmlns:rtba="using:Syncfusion.UI.Xaml.RichTextBoxAdv">
<Grid>
<rtba:SfRichTextBoxAdv>
</rtba:SfRichTextBoxAdv>
</Grid>
But so far as I can tell, there is no way to import Block data or use an HTML string. The latter used to exist in WPF but it's not there anymore. Any suggestions?
Syncfusion SfRichTextBoxAdv control for WinRT supports importing and exporting HTML document, Word document, Rich Text Format document and Text document. With the help of this functionality, you can easily achieve your requirement by using Syncfusion SfRichTextBoxAdv control. Please do find the sample from below link.
Sample link:
http://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample-2055612463
Kindly go through the online KB from following link, to know more information about binding HTML string to SfRichTextBoxAdv control.
https://www.syncfusion.com/kb/5415/how-to-bind-html-text-in-sfrichtextboxadv-control
Regards,
Arumuga Perumal S.
I am using iTextSharp to generate a pdf invoice.
I have a template for the invoice which is very simple, but uses CSS3 for the formatting and styling.
when I display the page in a browser it works fine, but when I try to generate the page into a pdf using itextsharp it seems to ignore all the CSS3 formatting for some reason.
My question is: Is there a way to get it to work with CSS? Or is that a limitation of iTextSharp ?
Are your stylesheets linked with an absolute path or a relative one? PDF converters don't tend to work too well with relative paths.
I am trying to convert HTM to docx without using interop dll. I have tried with Dynamically generate a MS Word document using HTML & CSS and also with Html to OpenXml.
I don't find a way to convert with HTML to Docx with all the styles and images intact. Openxml does support styles but only when styles are inline. If I have the styles defined in CSS file then the styles does not get reflected.
What alternative can I go for to achieve this?
Queston 1 - Preserve Styling
Pre-process the HTML to inline the styles from the css file before using html2openxml to convert the document.
Question 2 - Preserve Images
Images are supposed to work in that converter according to here http://html2openxml.codeplex.com/wikipage?title=ImageProcessing&referringTitle=Documentation
maybe you need to debug this a bit / post more info
Edit
Maybe you forgot to set the base path
converter.BaseImageUrl = new Uri("http://myserver:8080/");
Is it possible to convert a webpage along with images and preserving styles into PDF document using open libraries like iTextSharp using C#.
Yes but.
iText[Sharp]'s style support is spotty at best. Your absolute best html->pdf bet is wkhtmltopdf. I haven't tried it personally, but it seems to have all its ducks in a row.