HTML-to-RTF Pro DLL .Net is a native C# component to convert HTML to RTF, Word and Text documents, merge and replace RTF files.
v. 5.0.12.12 - December 12th, 2012
  Overview | Getting Started | Code Samples | FAQ | History | License | Purchase | Support and Contacts

FAQ

Here you may find answers on most popular questions regarding HTML-to-RTF Pro DLL .Net. If you didn't find the answer to your question email us at support@sautinsoft.com.

CSS

  1. What CSS (Cascading Style Sheets) the component does support now?
  2. What is the best way to connect CSS into HTML that your component recognize it?

Images

  1. What type of images does the component support?
  2. I don't see images in RichTextBox after converting, why?

Header & Footer

  1. How can I put an image (logo) on the header?

Our answers

CSS

  1. What CSS (Cascading Style Sheets) the component does support now?

    Answer: First of all we've made that component supports all common CSS styles. We are improving the component everyday, so this is list is growing too as CSS specification. This is list with styles which are supported by the current version:

    B      
    background: background-color:    
    border: border-style: border-top-width: border-right-color:
    border-top: border-top-style: border-right-width: border-bottom-color:
    border-right: border-right-style: border-bottom-width: border-left-color:
    border-bottom: border-bottom-style: border-left-width: background-color:
    border-left: border-left-style: border-top-color: border-color:
    border-collapse:     border-width:
    C      
    color:      
    D      
    display:      
    F      
    font-size: font-family: font-weight: font-style:
    H      
    height:      
    M      
    margin: margin-top: margin-right: margin-bottom:
    margin-left:      
    P      
    padding: padding-top: padding-right: padding-bottom:
    padding-left: page-break-before: page-break-after: page-break-inside:
    T      
    text-align: text-indent: text-decoration:  
    V      
    visibility: vertical-align:    
    W      
    width: white-space:    
           
           
           

  2. What is the best way to connect CSS into HTML that your component recognize it?

    Answer: Actually the component supports all types of connecting CSS to HTML, so you may use any of them:

    1. Inline styles, inside the HTML document, style information on a single element, specified using the "style" attribute:
    <p style="font-family: Arial; color: red">
    
    2. Embedded style, blocks of CSS information inside the HTML document itself
    ...
    <style>
    st1
    {
      font-family: Arial;
      color: red;
    }
    </style>
    ...
    
    <p class="st1">
    or
    <p id="st1">
    
    3. External style sheets, i.e. a separate CSS-file referenced from the document
    <link href="css/styles.css" rel="stylesheet" type="text/css">
     
    or
    <link href="http://mysite.com/css/styles.css" rel="stylesheet" type="text/css">

 

Images

  1. What type of images does the component support?

    Answer: It supports JPG, BMP, JPEG, PNG and GIF images. You may specify a full path to image, hyperlink, UNC path or a relative path. These are examples which are supported by the HTML-to-RTF Pro DLL .Net component:
    <img src="file://c:\workingfolder\picture.jpg">
    <img src="http://mydomain.com/image1.png">
    <img src="www.mydomain.com/image1.png">
    <img src="../webs/picture.jpeg">
    <img src="//server/webs/picture.jpg">
    <img src="sample.gif">
    If you are using a relative path image and converting method ConvertString() or ConvertStringToFile() don't forget to specify the property BaseURL, for example:
    SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
    h.BaseURL = Server.MapPath("");
    string html = "<img src=\"sample.gif\">";
    string rtf = h.ConvertString(html);
    
  2. I don't see images in RichTextBox after converting, why?

    Answer: The problem is that the RichTextBox and WordPad supports images stored in RTF as BMP, the MS Word supports RTF with images stored in different formats: JPG, PNG, EMF and BMP. But by default our library saves images inside RTF in JPEG and PNG formats to make RTF document less size.

    It's easy adjust the component to produce RTF compatible with RichTextBox:

    SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
    h.ImageCompatible = HtmlToRtf.eImageCompatible.WordPad;
    

Header & Footer

  1. How can I put an image (logo) on the header?

    Answer: First of all, I can say that you may specify page header or footer in any of these formats: HTML, RTF, Text. Another fact is that you may put in header/footer HTML, RTF or Text from string, local file or URL.

    Use these are properties to specify header and footer correspondingly: PageHeader and PageFooter

    Let's create a sample in C# and VB.Net - how to put image (logo) on the header. We'll create a simple table in HTML format and put url to logo-image into first cell.

    C#:
    SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
    //Here is our header in HTML format
    string header = "<table width=\"100%\" border=\"0\">" +
                  "<tr>" +
    			  "<td width=\"200\"><img src=\"http://www.google.com/images/logos/ps_logo2.png\" width=\"364\" height=\"126\"></td>" +
    			  "<td><div align=\"center\"><font color=\"#0099FF\" size=\"4\">Some</font><em> text</em> in <strong>header</strong></div></td>" +
    			  "</tr>" +
    			  "</table>";
    //specify page header
    h.PageStyle.PageHeader.Html(header);
    //convert our main HTML document to RTF
    h.ConvertFile(@"d:\test.htm", @"d:\test.rtf");
    VB.Net:
    Dim h As New SautinSoft.HtmlToRtf()
    'Here is our header in HTML format
    Dim header As String = "<table width=""100%"" border=""0"">" & "<tr>" & "<td width=""200""><img src=""http://www.google.com/images/logos/ps_logo2.png"" width=""364"" height=""126""></td>" & "<td><div align=""center""><font color=""#0099FF"" size=""4"">Some</font><em> text</em> in <strong>header</strong></div></td>" & "</tr>" & "</table>"
    'specify page header
    h.PageStyle.PageHeader.Html(header)
    'convert our main HTML document to RTF
    h.ConvertFile("d:\test.htm", "d:\test.rtf")
© Copyright SautinSoft™ 2002 - 2013