예제 #1
0
        public static void ConvertHtmlToRtfString()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            string inputFile  = @"..\..\pic.html";
            string outputFile = "Result.rtf";

            // Read our HTML file a string.
            string htmlString = File.ReadAllText(inputFile);

            // Specify the 'BaseURL' property that component can find the full path to images, like a: <img src="..\pict.png" and
            // to external css, like a:  <link rel="stylesheet" href="/css/style.css">.
            h.BaseURL = Path.GetDirectoryName(Path.GetFullPath(inputFile));

            if (h.OpenHtml(htmlString))
            {
                string rtfString = h.ToRtf();

                // Open the result for demonstration purposes.
                if (!String.IsNullOrEmpty(rtfString))
                {
                    File.WriteAllText(outputFile, rtfString);
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile)
                    {
                        UseShellExecute = true
                    });
                }
            }
        }
예제 #2
0
        public static void ConvertHtmlUrlToRtfFile()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            string inputFile  = @"https://www.sautinsoft.net/samples/utf-8.html";
            string outputFile = "Result.rtf";

            // Specify the 'BaseURL' property that component can find the full path to images, like a: <img src="..\pict.png" and
            // to external css, like a:  <link rel="stylesheet" href="/css/style.css">.
            h.BaseURL = @"https://www.sautinsoft.net/samples/utf-8.html";

            if (h.OpenHtml(inputFile))
            {
                bool ok = h.ToRtf(outputFile);

                // Open the result for demonstration purposes.
                if (ok)
                {
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile)
                    {
                        UseShellExecute = true
                    });
                }
            }
        }
예제 #3
0
        public static void ConvertHtmlToDocxFile()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            string inputFile  = @"..\..\sample.html";
            string outputFile = "Result.docx";

            // Set page size and page margins.
            h.PageStyle.PageSize.A5();
            h.PageStyle.PageMarginTop.Mm(30);
            h.PageStyle.PageMarginBottom.Mm(30);
            h.PageStyle.PageMarginLeft.Mm(50);
            h.PageStyle.PageMarginRight.Mm(50);

            if (h.OpenHtml(inputFile))
            {
                bool ok = h.ToDocx(outputFile);

                // Open the result for demonstration purposes.
                if (ok)
                {
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile)
                    {
                        UseShellExecute = true
                    });
                }
            }
        }
예제 #4
0
        public static void ConvertHtmlToRtfStream()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            string inputFile  = @"..\..\utf-8.html";
            string outputFile = "Result.rtf";

            // Specify the 'BaseURL' property that component can find the full path to images, like a: <img src="..\pict.png" and
            // to external css, like a:  <link rel="stylesheet" href="/css/style.css">.
            h.BaseURL = Path.GetDirectoryName(Path.GetFullPath(inputFile));

            using (FileStream htmlFileStrem = new FileStream(inputFile, FileMode.Open))
            {
                if (h.OpenHtml(htmlFileStrem))
                {
                    using (MemoryStream rtfMemoryStream = new MemoryStream())
                    {
                        bool ok = h.ToRtf(rtfMemoryStream);

                        // Open the result for demonstration purposes.
                        if (ok)
                        {
                            File.WriteAllBytes(outputFile, rtfMemoryStream.ToArray());
                            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile)
                            {
                                UseShellExecute = true
                            });
                        }
                    }
                }
            }
        }
예제 #5
0
        public static void ConvertHtmlToTextString()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            string inputFile  = @"..\..\Sample.html";
            string outputFile = "Result.txt";

            // Read our HTML file a string.
            string htmlString = File.ReadAllText(inputFile);

            if (h.OpenHtml(htmlString))
            {
                string textString = h.ToText();

                // Open the result for demonstration purposes.
                if (!String.IsNullOrEmpty(textString))
                {
                    File.WriteAllText(outputFile, textString);
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile)
                    {
                        UseShellExecute = true
                    });
                }
            }
        }
예제 #6
0
        /// <summary>
        /// Converts HTML to DOCX and sets the uniform Font Family, Size and Color for all text.
        /// </summary>
        public static void SetSingleFontProperties()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            string inputFile  = @"..\..\Sample.html";
            string outputFile = "Result.docx";

            // Let's make all text in document the same: Calibri, 32pt, Gray.
            h.TextStyle.SingleFontFamily = "Calibri";
            h.TextStyle.SingleFontSize   = 32;
            h.TextStyle.SingleFontColor  = System.Drawing.Color.Gray;

            if (h.OpenHtml(inputFile))
            {
                bool ok = h.ToDocx(outputFile);

                // Open the result for demonstration purposes.
                if (ok)
                {
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile)
                    {
                        UseShellExecute = true
                    });
                }
            }
        }
예제 #7
0
        public void CargarAlojamientos(String nombreSeleccionado)
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
            h.OutputFormat = SautinSoft.HtmlToRtf.eOutputFormat.TextUnicode;

            foreach (XmlElement nodo in listaService)
            {
                if (Convert.ToString(nodo["basicData"]["name"].InnerText).Equals(nombreSeleccionado))
                {
                    try
                    {
                        alojamiento.nombre             = Convert.ToString(nodo["basicData"]["name"].InnerText);
                        alojamiento.email              = nodo["basicData"]["email"].InnerText;
                        alojamiento.telefono           = nodo["basicData"]["phone"].InnerText;
                        alojamiento.codPostal          = nodo["geoData"]["zipcode"].InnerText;
                        alojamiento.fechaActualizacion = nodo.Attributes["fechaActualizacion"].Value;
                        alojamiento.web          = nodo["basicData"]["web"].InnerText;
                        alojamiento.direccion    = nodo["geoData"]["address"].InnerText;
                        alojamiento.pais         = nodo["geoData"]["country"].InnerText;
                        alojamiento.ciudad       = nodo["geoData"]["subAdministrativeArea"].InnerText;
                        alojamiento.tipo         = nodo["extradata"].SelectSingleNode("item[@name='Tipo']").InnerText;
                        alojamiento.categoria    = nodo["extradata"]["categorias"]["categoria"].SelectSingleNode("item[@name='Categoria']").InnerText;
                        alojamiento.subCategoria = nodo["extradata"]["categorias"]["categoria"]["subcategorias"]["subcategoria"].SelectSingleNode("item[@name='SubCategoria']").InnerText;
                        alojamiento.descripcion  = h.ConvertString(nodo["basicData"]["body"].InnerText);
                        multimedia = nodo["multimedia"];
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }
            }

            CargarDireccionesImagenes();
        }
예제 #8
0
        public static void ConvertHtmlToTextStream()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            string inputFile  = @"..\..\Sample.html";
            string outputFile = "Result.txt";

            using (FileStream htmlFileStrem = new FileStream(inputFile, FileMode.Open))
            {
                if (h.OpenHtml(htmlFileStrem))
                {
                    using (MemoryStream ms = new MemoryStream())
                    {
                        bool ok = h.ToText(ms);

                        // Open the result for demonstration purposes.
                        if (ok)
                        {
                            File.WriteAllBytes(outputFile, ms.ToArray());
                            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile)
                            {
                                UseShellExecute = true
                            });
                        }
                    }
                }
            }
        }
예제 #9
0
        public static void cargarNodo()
        {
            List <string> imagenes = new List <string>();

            XmlNodeList listaAlojamientos = documento.SelectNodes("serviceList/service");

            SautinSoft.HtmlToRtf html = new SautinSoft.HtmlToRtf();
            html.OutputFormat = SautinSoft.HtmlToRtf.eOutputFormat.TextUnicode;

            foreach (XmlNode a in listaAlojamientos)
            {
                alojamiento             = new Alojamiento();
                alojamiento.Codigo      = a.Attributes["id"].Value;
                alojamiento.Nombre      = WebUtility.HtmlDecode(a["basicData"]["name"].InnerText);
                alojamiento.Email       = a["basicData"]["email"].InnerText;
                alojamiento.Telefono    = a["basicData"]["phone"].InnerText;
                alojamiento.Descripcion = html.ConvertString(a["basicData"]["body"].InnerText).Replace("\r\nTrial version converts only first 100000 characters. Evaluation only.", "");
                alojamiento.Web         = a["basicData"]["web"].InnerText;
                alojamiento.Direccion   = a["geoData"]["address"].InnerText;
                alojamiento.Localidad   = a["geoData"]["subAdministrativeArea"].InnerText;
                alojamiento.CP          = a["geoData"]["zipcode"].InnerText;

                XmlNodeList listaMultimedia = a["multimedia"].ChildNodes;
                imagenes = new List <string>();
                foreach (XmlElement m in listaMultimedia)
                {
                    imagenes.Add(m.InnerText);
                }
                alojamiento.Imagenes = imagenes;

                XmlNodeList listaExtradata = a["extradata"].ChildNodes;
                foreach (XmlElement e in listaExtradata)
                {
                    if (e.Name == "categorias")
                    {
                        //XmlNodeList listaCategoria = e["categoria"].ChildNodes;
                        XmlNodeList listaCategoria = e.SelectNodes("categoria");
                        foreach (XmlElement c in listaCategoria)
                        {
                            if (c.Name == "subcategorias")
                            {
                                XmlNodeList listaSubcategoria = c["subcategoria"].ChildNodes;
                                foreach (XmlElement s in listaSubcategoria)
                                {
                                    if (s.Attributes["name"].Value == "SubCategoria")
                                    {
                                        alojamiento.Estrellas = s.InnerText;
                                    }
                                }
                            }
                        }
                    }
                }
                alojamientos.Add(alojamiento);
            }
        }
예제 #10
0
        public static void ConvertMultipleHtmlToText()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            string inpFolder = @"..\..\Testing HTMLs\";
            string outFolder = new DirectoryInfo(Directory.GetCurrentDirectory()).CreateSubdirectory("Text").FullName;

            string[] inpFiles = Directory.GetFiles(inpFolder, "*.htm*");

            int total        = inpFiles.Length;
            int currCount    = 1;
            int successCount = 0;

            foreach (string inpFile in inpFiles)
            {
                string fileName = Path.GetFileName(inpFile);
                Console.Write("{0:D2} of {1} ... {2}", currCount, total, fileName);
                currCount++;

                bool ok = true;

                if (h.OpenHtml(inpFile))
                {
                    string outFile = Path.Combine(outFolder, Path.ChangeExtension(fileName, ".txt"));

                    if (h.ToText(outFile))
                    {
                        successCount++;
                    }
                    else
                    {
                        ok = false;
                    }
                }
                else
                {
                    ok = false;
                }

                Console.WriteLine(" ({0})", ok);
            }
            Console.WriteLine("{0} of {1} HTML(s) converted successfully!", successCount, total);
            Console.WriteLine("Press any key ...");
            Console.ReadKey();

            // Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFolder)
            {
                UseShellExecute = true
            });
        }
예제 #11
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string rtfString = String.Empty;

        SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

        // After purchasing the license, please insert your serial number here to activate the component.
        // h.Serial = "XXXXXXXXX";

        // Page properties.
        h.PageStyle.PageSize.Letter();
        h.PageStyle.PageMarginLeft.Mm(25);
        // Get HTML content of the current .aspx page
        // 1. Gets the url of the page
        string url = Request.Url.ToString();

        // 2. Download the HTML content
        string         html    = String.Empty;
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

        request.AutomaticDecompression = DecompressionMethods.GZip;
        using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            using (Stream responseStream = response.GetResponseStream())
                using (StreamReader streamReader = new StreamReader(responseStream))
                {
                    html = streamReader.ReadToEnd();
                }

        // Specify the property 'BaseURL', because we're loading HTML string and
        // it may contain relative paths to images or external .css.
        // The 'BaseURL' helps to get an absolute path from a relative.
        h.BaseURL = url;

        if (h.OpenHtml(html))
        {
            rtfString = h.ToRtf();
        }

        // Show result in the default RTF viewer app.
        if (!String.IsNullOrEmpty(rtfString))
        {
            Response.Clear();
            Response.ContentType = "application/rtf";
            Response.AddHeader("content-disposition", "inline; filename=\"Result.rtf\"");
            byte[] data = System.Text.Encoding.UTF8.GetBytes(rtfString);
            Response.BinaryWrite(data);
            Response.Flush();
            Response.End();
        }
        else
        {
            Result.Text = "Converting failed!";
        }
    }
예제 #12
0
        private static string ExtractTextWithSautinSoft(string htmlString)
        {
            var h = new SautinSoft.HtmlToRtf();

            if (!h.OpenHtml(htmlString))
            {
                return(string.Empty);
            }
            var rtfString = h.ToText();

            return(rtfString);
        }
예제 #13
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

        // After purchasing the license, please insert your serial number here to activate the component.
        // h.Serial = "XXXXXXXXX";

        //here we specify page numbers
        h.PageStyle.PageNumbers.Appearance = SautinSoft.HtmlToRtf.ePageNumberingAppearence.PageNumFirst;

        //specify HTML format as string
        h.PageStyle.PageHeader.Html("<table border=\"1\"><tr><td>We added this header using the property \"Header.Html\"</td></tr></table>");

        //add footer from HTML file
        h.PageStyle.PageFooter.FromHtmlFile(Path.Combine(Server.MapPath(""), @"footer.htm"));

        // Get HTML content of the current .aspx page
        // 1. Gets the url of the page
        string url = Request.Url.ToString();

        // 2. Download the HTML content
        string htmlString = GetHtmlFromAspx(url);

        // Specify the property 'BaseURL', because we're loading HTML string and
        // it may contain relative paths to images or external .css.
        // The 'BaseURL' helps to get an absolute path from a relative.
        h.BaseURL = url;

        string rtfString = String.Empty;

        if (h.OpenHtml(htmlString))
        {
            rtfString = h.ToRtf();
        }

        // Show result in the default RTF viewer app.
        if (!String.IsNullOrEmpty(rtfString))
        {
            Response.Clear();
            Response.ContentType = "application/rtf";
            Response.AddHeader("content-disposition", "inline; filename=\"Result.rtf\"");
            byte[] data = System.Text.Encoding.UTF8.GetBytes(rtfString);
            Response.BinaryWrite(data);
            Response.Flush();
            Response.End();
        }
        else
        {
            Result.Text = "Converting failed!";
        }
    }
예제 #14
0
        public static void MergeFiles()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            DirectoryInfo htmlDir = new DirectoryInfo(@"..\..\");

            // Array with several RTF files.
            string[] rtfFiles  = new string[] { "footer.rtf", "footer.rtf", "footer.rtf" };
            string   singleRtf = String.Empty;

            // Let's divide RTF documents using page break.
            h.MergeOptions.PageBreakBetweenDocuments = true;

            foreach (string rtfFile in rtfFiles)
            {
                string rtfFilePath = Path.Combine(htmlDir.FullName, rtfFile);

                // Copy 1st RTF to 'singleRtf'
                if (String.IsNullOrEmpty(singleRtf))
                {
                    singleRtf = File.ReadAllText(rtfFilePath);
                }

                // Merge 2nd, 3rd ....
                else
                {
                    singleRtf = h.MergeRtfString(singleRtf, File.ReadAllText(rtfFilePath));
                }
            }

            // Save 'singleRtf' to a file only for demonstration purposes.
            string singleRtfPath = "Single.rtf";

            File.WriteAllText(singleRtfPath, singleRtf);
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(singleRtfPath)
            {
                UseShellExecute = true
            });
        }
예제 #15
0
        public static void Export(string htmlPath, string licenseKey)
        {
            // Convert HTML string to RTF file.
            // If you need more information about HTML-to-RTF Pro DLL .Net email us at:
            // support[at]sautinsoft.com
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // Please insert your serial number here after purchasing the component
            h.Serial = licenseKey;

            string htmlString = "";
            string rtfPath    = Path.ChangeExtension(htmlPath, ".rtf");

            // Get HTML string from a file.
            htmlString = File.ReadAllText(htmlPath);

            // Set 'BaseUrl' that component can find a full path to .css and images
            h.BaseURL = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(htmlPath));

            //h.PreserveFontColor = false;
            h.PreserveBackgroundColor = false;
            h.PreserveFontSize        = true;

            //h.FontSize = 12;

            //SautinSoft.HtmlToRtf.CFont

            // Invoke the method to convert HTML string into RTF file.
            int ret = h.ConvertStringToFile(htmlString, rtfPath);

            // 0 - converting successfully
            // 1 - can't open input file or URL, check the input path
            // 2 - can't create output file, check the output path
            // 3 - converting failed

            /*if (ret == 0)
             * {
             *  // Show produced RTF file
             *  System.Diagnostics.Process.Start(rtfPath);
             * }*/
        }
예제 #16
0
        public static void AddPageNumbering()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            string inputFile  = @"..\..\Sample.html";
            string outputFile = "Result.rtf";

            // Add page numbering.
            // Let's set page numbers from 1st page
            h.PageStyle.PageNumbers.Appearance = SautinSoft.HtmlToRtf.ePageNumberingAppearence.PageNumFirst;

            // Let's align page numbers by top-center
            h.PageStyle.PageNumbers.AlignV = SautinSoft.HtmlToRtf.eAlign.Top;
            h.PageStyle.PageNumbers.AlignH = SautinSoft.HtmlToRtf.eAlign.Center;

            // Let's set page numbers format as "Page 1 of 20".
            h.PageStyle.PageNumbers.Format = "Page {page} of {numpages}";

            // Set page numbers font: Calibry, 36.
            h.PageStyle.PageNumbers.Font.Face = "Calibri";
            h.PageStyle.PageNumbers.Font.Size = 36;


            if (h.OpenHtml(inputFile))
            {
                bool ok = h.ToDocx(outputFile);

                // Open the result for demonstration purposes.
                if (ok)
                {
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile)
                    {
                        UseShellExecute = true
                    });
                }
            }
        }
예제 #17
0
        public static void ReplaceValuesInRtf()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            // For example, we've RTF with such content "This is a sample footer as RTF document."
            // Let's replace the string "sample" by another RTF file.
            string sourceRtfFile           = @"..\..\footer.rtf";
            string wherewithReplaceRtfPath = @"..\..\footer.rtf";
            string textToReplace           = "sample";
            string resultRtfFile           = "Result.rtf";

            h.MergeOptions.PageBreakBetweenDocuments = false;
            h.MergeAndReplaceRtfFileFromFile(sourceRtfFile, textToReplace, wherewithReplaceRtfPath, resultRtfFile);

            // Show the result.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(resultRtfFile)
            {
                UseShellExecute = true
            });
        }
예제 #18
0
        public static void AddHeaderAndFooter()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            string inputFile  = @"..\..\Sample.html";
            string outputFile = "Result.docx";

            // Set page header and footer.
            string headerFromHtml = File.ReadAllText(@"..\..\header.html");
            string footerFromRtf  = File.ReadAllText(@"..\..\footer.rtf");

            // Add page header.
            h.PageStyle.PageHeader.Html(headerFromHtml);

            // Add extra space between header and page contents.
            h.PageStyle.PageHeader.MarginBottom.Mm(10);

            // Add page footer.
            h.PageStyle.PageFooter.Rtf(footerFromRtf);

            if (h.OpenHtml(inputFile))
            {
                bool ok = h.ToDocx(outputFile);

                // Open the result for demonstration purposes.
                if (ok)
                {
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile)
                    {
                        UseShellExecute = true
                    });
                }
            }
        }
예제 #19
0
        public static void ConvertHtmlToDocxFile()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            string inputFile  = @"..\..\Sample.html";
            string outputFile = "Result.docx";

            if (h.OpenHtml(inputFile))
            {
                bool ok = h.ToDocx(outputFile);

                // Open the result for demonstration purposes.
                if (ok)
                {
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile)
                    {
                        UseShellExecute = true
                    });
                }
            }
        }
예제 #20
0
        public static void MergeRtfsInMemory()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // After purchasing the license, please insert your serial number here to activate the component.
            // h.Serial = "XXXXXXXXX";

            // Now we've both RTF documents stored in memory in String objects.
            string rtfString1 = File.ReadAllText(@"..\..\footer.rtf");
            string rtfString2 = File.ReadAllText(@"..\..\footer.rtf");

            string rtfSingle = h.MergeRtfString(rtfString1, rtfString2);

            // Save 'rtfSingle' to a file for demonstration purposes and show it.
            if (!String.IsNullOrEmpty(rtfSingle))
            {
                string singleRtfFile = "Single.rtf";
                File.WriteAllText(singleRtfFile, rtfSingle);
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(singleRtfFile)
                {
                    UseShellExecute = true
                });
            }
        }
        /// <summary>
        /// Convert xhtml to rtf with Sautin converter
        /// </summary>
        /// <param name="xhtml"></param>
        /// <param name="rtfFile"></param>
        public static bool ConvertSautin(string rtfFile, string xhtml)
        {
            try
            {
                xhtml = XhtmlFromReqIf(xhtml);
                // write to *.docx
                if (String.IsNullOrWhiteSpace(xhtml))
                {
                    xhtml = "Empty!!!";
                }

                // Developer License
                SautinSoft.HtmlToRtf h;
                try
                {
                    h = new SautinSoft.HtmlToRtf {
                        Serial = "10281946238"
                    };
                }
                catch (Exception e)
                {
                    MessageBox.Show($@"No license available

You may use convert to *.docx (Settings: ""UseMariGold""     :  ""true""

{e}
", @"Can't load SautinSoft library, Break");
                    return(false);
                }

                string xhtmlFile = System.IO.Path.GetDirectoryName(rtfFile);
                xhtmlFile = System.IO.Path.Combine(xhtmlFile, "xxxxxx.xhtml");

                //rtfFile = System.IO.Path.GetDirectoryName(rtfFile);
                //rtfFile = System.IO.Path.Combine(rtfFile, "xxxxxx.rtf");


                System.IO.File.WriteAllText(xhtmlFile, xhtml);
                if (h.OpenHtml(xhtmlFile))
                {
                    bool ok;
                    if (xhtml.Contains("<img"))
                    {
                        xhtml = xhtml.Replace(@"type=""image/png""", "");
                        ok    = h.ToRtf(rtfFile);
                    }
                    else
                    {
                        ok = h.ToRtf(rtfFile);
                    }
                    if (!ok)
                    {
                        MessageBox.Show($@"XHTML:'{xhtml}{Environment.NewLine}File:{rtfFile}", @"Error0 converting XHTML to *.rtf");
                        return(false);
                    }
                }
                else
                {
                    MessageBox.Show($@"XHTML:'{xhtml}{Environment.NewLine}File:{rtfFile}", @"Error1 converting XHTML to *.rtf");
                    return(false);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show($@"XHTML:'{xhtml}{Environment.NewLine}{Environment.NewLine}{e}", @"Error converting XHTML to *.rtf");
                return(false);
            }

            return(true);
        }