:
These source code samples are assembled by their programming language and functions they use. ByteScout Premium Suite was made to help with searchablepdfmaker progress indication with PDF extractor SDK in C#. ByteScout Premium Suite is the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.
Want to speed up the application development? Then this C#, code samples for C#, developers help to speed up the application development and writing a code when using ByteScout Premium Suite. Just copy and paste this C# sample code to your C# application’s code editor, add a reference to ByteScout Premium Suite (if you haven’t added yet) and you are ready to go! C# application implementation mostly involves various stages of the software development so even if the functionality works please check it with your data and the production environment.
ByteScout Premium Suite is available as a free trial. You may get it from our website along with all other source code samples for C# applications.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
using System; using System.Diagnostics; using Bytescout.PDFExtractor; namespace SearchablePDFMakerProgressChangedEvent { class Program { static void Main(string[] args) { try { using (var searchablePDFMaker = new SearchablePDFMaker("demo", "demo")) { // Load sample PDF document searchablePDFMaker.LoadDocumentFromFile("sample_ocr.pdf"); // Extractor Progress event Console.WriteLine("Searchable PDF making in progress: \n"); searchablePDFMaker.ProgressChanged += SearchablePDF_ProgressChanged; // Set the location of OCR language data files searchablePDFMaker.OCRLanguageDataFolder = @"c:\Program Files\Bytescout PDF Extractor SDK\ocrdata\"; // Set OCR language searchablePDFMaker.OCRLanguage = "eng"; // "eng" for english, "deu" for German, "fra" for French, "spa" for Spanish etc - according to files in "ocrdata" folder // Find more language files at https://github.com/bytescout/ocrdata // Set PDF document rendering resolution searchablePDFMaker.OCRResolution = 300; // Save extracted text to file searchablePDFMaker.MakePDFSearchable("output.pdf"); // Open result document in default associated application (for demo purpose) ProcessStartInfo processStartInfo = new ProcessStartInfo("output.pdf"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("\n\n Press enter key to exit..."); Console.ReadLine(); } /// <summary> /// Handle progress change event /// </summary> private static void SearchablePDF_ProgressChanged(object sender, OngoingOperation ongoingOperation, double progress, ref bool cancel) { drawTextProgressBar(Convert.ToInt32(progress), 100); } /// <summary> /// Display progress bar /// </summary> private static void drawTextProgressBar(int progress, int total) { //draw empty progress bar Console.CursorLeft = 0; Console.Write("["); //start Console.CursorLeft = 32; Console.Write("]"); //end Console.CursorLeft = 1; float onechunk = 30.0f / total; //draw filled part int position = 1; for (int i = 0; i < onechunk * progress; i++) { Console.BackgroundColor = ConsoleColor.Green; Console.CursorLeft = position++; Console.Write(" "); } //draw unfilled part for (int i = position; i <= 31; i++) { Console.BackgroundColor = ConsoleColor.Gray; Console.CursorLeft = position++; Console.Write(" "); } //draw totals Console.CursorLeft = 35; Console.BackgroundColor = ConsoleColor.Black; Console.Write(progress.ToString() + " of " + total.ToString() + " "); //blanks at the end remove any excess } } }
60 Day Free Trial or Visit ByteScout Premium Suite Home Page
Explore ByteScout Premium Suite Documentation
Explore Samples
Sign Up for ByteScout Premium Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Premium Suite Home Page
Explore ByteScout Premium Suite Documentation
Explore Samples
Sign Up for ByteScout Premium Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: