IronOCR How-Tos hOCR Export as HTML How to Save Results as hOCR in an HTML File Chaknith Bin Updated:July 28, 2025 hOCR, which stands for "HTML-based OCR," is a file format used to represent the results of Optical Character Recognition (OCR) in a structured manner. HOCR files are typically written in HTML (Hypertext Markup Language) and provide a way to store recognized text, layout information, and the coordinates of each recognized character within an image or document. IronOCR provides a solution for performing optical character recognition on documents and exporting the results as hOCR in HTML format. It supports both HTML files and strings. Get started with IronOCR Start using IronOCR in your project today with a free trial. First Step: Start for Free How to Save Results as hOCR in an HTML File Download a C# library to save results as hOCR in an HTML file Prepare the targeted image and PDF document Set the RenderHocr property to true Utilize the SaveAsHocrFile method to output an HTML file Use the SaveAsHocrString method to output an HTML string Export Result as hOCR Example To export the result as hOCR, the user must first enable the Configuration.RenderHocr property by setting it to true. After obtaining the OCR result object from the Read method, use the SaveAsHocrFile method to export the OCR result as HTML. This method will output an HTML file that contains the reading result of the input documents. The code below demonstrates using the following sample TIFF file. :path=/static-assets/ocr/content-code-examples/how-to/html-export-export-html.cs using IronOcr; // Instantiate IronTesseract IronTesseract ocrTesseract = new IronTesseract(); // Enable render as hOCR ocrTesseract.Configuration.RenderHocr = true; // Add image using var imageInput = new OcrImageInput("Potter.tiff"); imageInput.Title = "Html Title"; // Perform OCR OcrResult ocrResult = ocrTesseract.Read(imageInput); // Export as HTML ocrResult.SaveAsHocrFile("result.html"); Imports IronOcr ' Instantiate IronTesseract Private ocrTesseract As New IronTesseract() ' Enable render as hOCR ocrTesseract.Configuration.RenderHocr = True ' Add image Dim imageInput = New OcrImageInput("Potter.tiff") imageInput.Title = "Html Title" ' Perform OCR Dim ocrResult As OcrResult = ocrTesseract.Read(imageInput) ' Export as HTML ocrResult.SaveAsHocrFile("result.html") $vbLabelText $csharpLabel Export Result as HTML String Using the same TIFF sample image, you can utilize the SaveAsHocrString method to export the OCR result as an HTML string. This method will return an HTML string. :path=/static-assets/ocr/content-code-examples/how-to/html-export-export-html-string.cs // Export as HTML string string hocr = ocrResult.SaveAsHocrString(); ' Export as HTML string Dim hocr As String = ocrResult.SaveAsHocrString() $vbLabelText $csharpLabel Frequently Asked Questions What is hOCR and why is it used? hOCR stands for 'HTML-based OCR,' and it is a file format used to represent the results of Optical Character Recognition in a structured manner. It is used to store recognized text, layout information, and the coordinates of each character within an image or document, typically in HTML format. How can I save OCR results as an hOCR file using C#? You can save OCR results as an hOCR file using IronOCR by first setting the RenderHocr property to true, and then using the SaveAsHocrFile method to output the results as an HTML file. Can OCR results be exported as an HTML string? Yes, OCR results can be exported as an HTML string using IronOCR by setting the RenderHocr property to true and employing the SaveAsHocrString method, which returns the OCR results in an HTML string format. Does IronOCR support OCR processing for both images and PDFs? IronOCR supports OCR processing for both images and PDF documents, allowing users to export the results as hOCR in HTML format. What steps are involved in exporting OCR results as hOCR in C#? To export OCR results as hOCR using C#, download the IronOCR library, prepare your image or PDF document, set the RenderHocr property to true, and use either SaveAsHocrFile or SaveAsHocrString to export the results. What programming environment is suitable for using IronOCR? IronOCR is suitable for use within the .NET C# programming environment, making it ideal for developers working with C#. Is there example code available for saving OCR results as hOCR? Yes, IronOCR provides example C# code demonstrating how to read text from an image file and save the OCR results as an hOCR file or string, with practical examples using sample TIFF files. How is the RenderHocr property utilized in IronOCR? The RenderHocr property in IronOCR is used to enable the export of OCR results in the hOCR format. Setting it to true allows the results to be exported as either an HTML file or string. Chaknith Bin Chat with engineering team now Software Engineer Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience. Reviewed by Jeffrey T. Fritz Principal Program Manager - .NET Community Team Jeff is also a Principal Program Manager for the .NET and Visual Studio teams. He is the executive producer of the .NET Conf virtual conference series and hosts 'Fritz and Friends' a live stream for developers that airs twice weekly where he talks tech and writes code together with viewers. Jeff writes workshops, presentations, and plans content for the largest Microsoft developer events including Microsoft Build, Microsoft Ignite, .NET Conf, and the Microsoft MVP Summit Ready to Get Started? Free NuGet Download Total downloads: 4,306,473 View Licenses