Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
dheeraj ghade20 reputationPosted Mar 16, 2015, 4:15 AM EDT
I would suggest that, try to convert whole or particular page of PDF file in image. Refer below link for reference
https://code.google.com/p/lib-pdf/
Rohan Ahmed4 reputationPosted Apr 2, 2015, 8:10 AM EDT
http://www.codeproject.com/Articles/278301/How-to-Read-Barcodes-from-Images-using-LEADTOOLS
Marvin ReidRank #1,963 · 746 reputationPosted Nov 20, 2023, 3:05 PM EST
A solution to this would be to leverage that you have access to the BarcodeData Bounds after barcode recognition is done. This will allow you to know where the barcodes are on the page. You can then supply the bounds into the CropCommand which would allow you to extract just the QR code. Here is some sample code which demonstrates this:
using (RasterCodecs codecs = new RasterCodecs()) { CropCommand crop = new CropCommand(); RasterImage image = codecs.Load(@"path to input file"); BarcodeEngine barcodeEngineInstance = new BarcodeEngine(); BarcodeData[] dataArray = barcodeEngineInstance.Reader.ReadBarcodes(image, LeadRect.Empty, 0, null); for (int i = 0; i < dataArray.Length; i++) { RasterImage cloneImage = image.Clone(); BarcodeData data = dataArray[i]; crop.Rectangle = data.Bounds; //get bounds of found barcode crop.Run(cloneImage); // extract just the barcode codecs.Save(cloneImage, @"Output path to save into file", RasterImageFormat.Png, 0); // save to output file } }https://www.leadtools.com/help/sdk/tutorials/dotnet-console-detect-and-extract-barcodes.html
https://www.leadtools.com/help/sdk/dh/l/imageprocessing-cropcommand-ctor(leadrect).html
Leon DRank #851 · 2.6K reputationPosted Nov 21, 2023, 3:23 AM EST
You can convert the pdf pages that contain QR codes to images:
https://www.e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/Convert-PDF-Page-to-Image-with-C-code.html