Link Search Menu Expand Document

Reduce Memory Usage During PDF to HTML Conversion - C#

PDF To HTML SDK sample in C# demonstrating ‘Reduce Memory Usage During PDF to HTML Conversion’

using System;
using System.Diagnostics;
using Bytescout.PDF2HTML;

namespace ReduceMemoryUsage
    class Program
        static void Main(string[] args)
            // When processing huge PDF documents you may run into OutOfMemoryException.
            // This example demonstrates a way to spare the memory by disabling page data caching.

            // Create Bytescout.PDF2HTML.HTMLExtractor instance
            using (HTMLExtractor extractor = new HTMLExtractor("demo", "demo"))
                    // Load sample PDF document

                    // Disable page data caching, so processed pages will be disposed automatically
                    extractor.PageDataCaching = PageDataCaching.None;

                    // Save result to file
                catch (PDF2HTMLException exception)

            // Open result document in default associated application (for demo purpose)
            ProcessStartInfo processStartInfo = new ProcessStartInfo("output.html");
            processStartInfo.UseShellExecute = true;

Download Source Code (.zip)

Return to the previous page Explore PDF To HTML SDK