Generate serialized barcodes

Hi everyone! Does anyone know how to autogenerate a number of unique code39 barcodes from a range of numbers, let's say from 0000001 to 0000050? I need to have the barcodes generated automatically and then printed using imposition printing.

I have the numbergen utility and I know how to use it with print merge feature from coreldraw but i have no idea how to make this possible with generating barcodes.

I'm attaching an image as an example (there will be two A5 invoices on a A4 sheet of paper)