ByteScout Barcode Reader SDK - C# - Reduce CPU Usage - ByteScout

ByteScout Barcode Reader SDK – C# – Reduce CPU Usage

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – C# – Reduce CPU Usage

How to reduce CPU usage in C# using ByteScout BarCode Reader SDK

This tutorial will show how to reduce CPU usage in C#

The documentation is designed to help you to implement the features on your side. What is ByteScout BarCode Reader SDK? It is the SDK for barcode decoding. Can read all popular types from Code 128, GS1, UPC and Code 39 to QR Code, Datamatrix, PDF417. Images, pdf, TIF images and live web camera are supported as input. Designed to handle documents with noise and defects. Includes optional splitter and merger for pdf and tiff based on barcodes. Batch mode is optimized for high performance with multiple threads. Decoded values can be exported to XML, JSON, CSV or into custom data format. It can help you to reduce CPU usage in your C# application.

C# code samples for C# developers help to speed up coding of your application when using ByteScout BarCode Reader SDK. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Enjoy writing a code with ready-to-use sample codes in C#.

ByteScout free trial version is available for download from our website. It includes all these programming tutorials along with source code samples.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System; using Bytescout.BarCodeReader; namespace ReduceCPUUsage { class Program { static void Main() { // Barcode reader instance Reader reader = new Reader(); reader.RegistrationName = "demo"; reader.RegistrationKey = "demo"; /* If you are reading barcodes from PDF then you may reduce CPU and RAM load using the following approach: - instead of using All1D or All2D barcode types, set it to the specific types you have in your documents like PDF417 or Code 39. You may set multiple barcode types if you need to - reduce PDF rendering resolution to 200-150 dpi (depends on your document) - set specific pages to read barcodes from. If you have barcodes on 2 first pages only then change the code to read barcodes from first 2 pages only. - if barcodes are always located / printed in the same corner then also specify the area to read from instead of whole page for scanning */ // Input filename string inputFileName = "barcode_multipage.pdf"; // Set specific barcode type to read reader.BarcodeTypesToFind.Code128 = true; // Reduce PDF rendering resolution reader.PDFRenderingResolution = 150; // Set specific area to read from reader.CustomAreaLeft = 407; reader.CustomAreaTop = 494; reader.CustomAreaHeight = 605; reader.CustomAreaWidth = 999; // Set specific page to read from along with filename reader.ReadFromPdfFilePage(inputFileName, 1, 1); // Get all found barcodes FoundBarcode[] barcodes = reader.FoundBarcodes; // Display found barcodes Console.WriteLine("Reading barcode(s) from PDF file..."); foreach (FoundBarcode barcode in barcodes) { Console.WriteLine("Found Barcode - Type: '{0}', Value: '{1}'", barcode.Type, barcode.Value); } // Cleanup reader.Dispose(); Console.WriteLine(); Console.WriteLine("Press any key to continue."); Console.ReadKey(); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next