Link Search Menu Expand Document

PDF To JSON - C#

PDF Extractor SDK sample in C# demonstrating ‘PDF To JSON’

Program.cs
using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.PDFExtractor;
using System.Diagnostics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create Bytescout.PDFExtractor.JSONExtractor instance
            JSONExtractor extractor = new JSONExtractor();
            extractor.RegistrationName = "demo";
            extractor.RegistrationKey = "demo";

            // Load sample PDF document
            extractor.LoadDocumentFromFile("sample3.pdf");

            extractor.SaveJSONToFile("output.json");

            // Cleanup
            extractor.Dispose();

            Console.WriteLine();
            Console.WriteLine("Data has been extracted to 'output.json' file.");
            Console.WriteLine();
            Console.WriteLine("Press any key to continue and open JSON in default viewer...");
            Console.ReadKey();

            ProcessStartInfo processStartInfo = new ProcessStartInfo("output.json");
            processStartInfo.UseShellExecute = true;
            Process.Start(processStartInfo);
        }
    }
}

Download Source Code (.zip)

Return to the previous page Explore PDF Extractor SDK