How to read barcoded value from PDF

damianleejob at gmail.com damianleejob at gmail.com
Fri May 17 04:07:56 EDT 2019


在 2011年6月28日星期二 UTC+8下午5:30:21,Robin Becker写道:
> On 28/06/2011 06:59, Asif Jamadar wrote:
> > Hi,
> >
> ...........
> >
> > In Reportlab I can do the following code to generate barcode and to get the value of that barcode
> >
> >
> >
> >          barcode=code39.Extended39("123456789",barWidth=0.2*mm,barHeight=8*mm)
> >
> >
> >
> >          bc = Paragraph("Barcode value: %s" % barcode.value, STYLES['Normal'])
> >
> >
> >
> >          document.append(bc)
> >
> > But how can I achieve this from the existing PDF document??
> .........
> 
> you might consider asking on the reportlab list as there is considerable 
> experience there about pdf in general.
> 
> It's unlikely that you will be able to easily discern which string/text in the 
> pdf corresponds to the barcode values that you are interested in.
> 
> PDF does allow things called annotations which reportlab can generate.
> 
> Alternatively you can generate an invisible string which may make more sense 
> than the simple barcode value. So when you draw the barcode you also need to add 
> the magic string using some prefix/postfix that allows easy extraction with 
> pypdf or similar eg
> 
> "===radamajfisa===123456789===radamajfisa===". Your text extractor should be 
> able to find this without too much trouble.
> -- 
> Robin Becker

You can check out this .net barcode reader for PDF document: http://www.barcodec.com/products/netpdfbarcodereader-all.html. It might be helpful.


More information about the Python-list mailing list