Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Friday, June 30, 2017 4:06:47 PM(UTC)


Groups: Registered, Tech Support, Administrators
Posts: 153

Was thanked: 9 time(s) in 9 post(s)

Sometimes, scanned documents are seperated into logical sections using patch pages. These patch pages are blank aside from a special type of barcode. The LEADTOOLS barcode SDK can recognize patch page codes and can subsequently be used to divide a PDF into multiple sections in memory. The code snippet below demonstrates this.


         BarcodeEngine engine = new BarcodeEngine();

         barcodeReader = engine.Reader;

         codecs.Options.Load.AllPages = true;
         RasterImage loadedImage = codecs.Load(@"Leadtools.pdf");
         List<RasterImage> docSections = new List<RasterImage>();

         // seed the initial documentSection with the first page of the document
         RasterImage img = loadedImage.Clone();

         // remove the first page since it's been seeded

         while (loadedImage.PageCount > 0)
            BarcodeData[] data = barcodeReader.ReadBarcodes(rasterImage, Leadtools.Forms.LogicalRectangle.Empty, 0, new BarcodeSymbology[] { BarcodeSymbology.PatchCode });

	    bool isPatchPage = data.Length > 0;
            // if we're on a patch page, finalize the current page range and begin a new one
            if (isPatchPage)

               img = loadedImage.Clone();

            else // otherwise, add this page

         // add the lastly-created page

This breaks the input document into a list of RasterImage objects, each RasterImage containing the page range between the patch pages. This can be modified to split documents by other parameters as well, such as different types of barcodes, detected characters via OCR, or anything else depending on development needs.

For more information, see our documentation on reading Barcodes.
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2023, Yet Another Forum.NET
This page was generated in 0.043 seconds.