.NET on Mac? Yes way!

Thanks for stopping by! With Visual Studio 2019 for Mac, developers can use the LEADTOOLS Xamarin and .NET Core libraries to accomplish their needs. This post will show you how easy it is to accomplish complex tasks using the LEADTOOLS NuGet packages.


Image Conversion Done in Seconds!

Leadtools.Codecs contains classes to load, save, and convert all types of images. Once you have created a project, you’ll need to add a reference to the Leadtools.Formats.Raster.Common NuGet Package. This will add support for formats such as BMP, JPEG, GIF, JPEG 2000, JBIG, PNG, TIFF, LEAD CMP, and more. You can use the code below to load any of the supported formats.

using (var codecs = new RasterCodecs())
{
   // Load image by passing a string with the file path
   RasterImage image = codecs.Load(inputFile);
   // Save image by passing in the image, a string with the output file path, the format, and the bits per pixel
   codecs.Save(image, outputPath, RasterImageFormat.Tif, 32);
}

Text Extraction with OCR Magic!

The LEADTOOLS OCR NuGet Package. To convert raster images to text-searchable PDF only requires a few lines of code using LEADTOOLS. Add the Leadtools.Ocr NuGet package to your solution to use the code below to convert images to text-searchable PDFs.

using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false))
    {
        ocrEngine.Startup(codecs, null, null, null;

        // Create an OCR document
        using (IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument())
        {
            // Add this image to the document
            IOcrPage ocrPage = ocrDocument.Pages.AddPage(image, null);

            // Auto-find the zones in the page
            ocrPage.AutoZone(null);

            // Recognize it and save it as a PDF file
            ocrPage.Recognize(null);

            ocrDocument.Save(outputPath, DocumentFormat.Pdf, null);
        }
    }

Need help?

Need help getting something going? Contact our support team for free technical support! For pricing or licensing questions, you can contact our sales team or call us at +1-704-332-5532.

About 

Technical Marketing Engineer

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *