How to read barcoded value from PDF
Robin Becker
robin at reportlab.com
Tue Jun 28 05:30:21 EDT 2011
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
More information about the Python-list
mailing list