Page 1 of 1

Document.Net instead of HTMLtoRTF.Net and RTFtoHTML.Net

Posted: Thu May 20, 2021 1:05 pm
by Denchik
Hi,

Already for a longer time we use your both products Rtf to Hmtl and Html to Rtf. Beside these two products you also offer Document .Net. Because of the price and the rough description on your homepage we are wondering if this product supports everything of the two others. So are we save if we replace the existing usage with this Document .Net? I was not able to find any migration steps / documents. Could you pls. let me know if anything is available?
Currently we are using your components in this way:

[code] var rtfToHtml = new RtfToHtml{
Encoding = RtfToHtml.eEncoding.UTF_8,
OutputFormat = RtfToHtml.eOutputFormat.HTML_5,
ImageStyle ={IncludeImageInHtml = includeImageInHtml},
TextStyle ={InlineCSS = true},
HtmlParts = RtfToHtml.eHtmlParts.Html_body,
Serial = SAUTIN_SERIAL_RTF_TO_HTML
};
htmlValue = rtfToHtml.ConvertString(rtfValue);


var htmlToText = new HtmlToRtf{Serial = SAUTIN_SERIAL_HTML_TO_RTF, OutputFormat = SautinSoft.HtmlToRtf.eOutputFormat.Rtf};
if (htmlToText.OpenHtml(htmlValue))
rtfText = htmlToText.ToRtf();[/code]

Could you pls. Let me know if this is doable in a similar way in Document .Net!

Re: Document.Net instead of HTMLtoRTF.Net and RTFtoHTML.Net

Posted: Thu May 20, 2021 1:12 pm
by Oliver
Hi

I must say, that Document.Net has its own RTF&HTML engine.

For example: Document.Net - "RTF to HTML conversion" can be saved in two modes: Fixed and Flowing.
And the results may not match with RTF2HTML.Net and HTLM2RTF.Net

You need to check all engines on your files. Maybe HTML2RTF.Net, RTF2HTML.Net will work better, than Document.Net.

Anyway, switching to a new engine (Document.Net) while maintaining the current settings is possible.

The code sample:

Code: Select all

static void ConvertRTF2HTML()
        {
            string inpFile = @"d:\exampleHTML.rtf";
            string outFileFixed = @"d:\example_fixed.html";
            string outFileFlowing = @"d:\example_flowing.html";
            DocumentCore dcfixed = DocumentCore.Load(inpFile, new RtfLoadOptions {});
            dcfixed.Save(outFileFixed, new HtmlFixedSaveOptions
            {   Version = HtmlVersion.Html5,
                Encoding =  System.Text.Encoding.UTF8,
                EmbedImages=true,
                EmbeddedImagesFormat=HtmlSaveOptions.EmbImagesFormat.Jpeg,
                CssExportMode = CssExportMode.Inline,
                ProduceOnlyHtmlBody = true
            }
            );
            DocumentCore dcflowing = DocumentCore.Load(inpFile, new RtfLoadOptions { });
            dcflowing.Save(outFileFlowing, new HtmlFlowingSaveOptions
            {
                Version = HtmlVersion.Html5,
                Encoding = System.Text.Encoding.UTF8,
                EmbedImages = true,
                EmbeddedImagesFormat = HtmlSaveOptions.EmbImagesFormat.Jpeg,
                CssExportMode = CssExportMode.Inline,
                ProduceOnlyHtmlBody = true,
                ListExportMode = HtmlListExportMode.ByHtmlTags
            }
            );

            // Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileFixed) { UseShellExecute = true });
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileFlowing) { UseShellExecute = true });
        }


static void ConvertHTML2RTF()
        {

            string inpFile = @"d:\exampleRTF.html";
            string outFile = @"d:\example.rtf";

            DocumentCore dc = DocumentCore.Load(inpFile, new HtmlLoadOptions {});
            dc.Save(outFile, new RtfSaveOptions {});

            // Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true });
        }