Create Reprint File by reading barcode

Hi

We have a closed loop enclosing system where by an spoils get reported back to us and I want to create a new print file based on which records are needed. I have create a process where by it reads in the file which details the records that are needed for reprinting. I then read in the original file and run through a barcode scan so I can then flag the pages that are needed as the barcode on each page contains the info I need.

But I’m not sure how to then output the new PDF as I’ve only created output by setting up a mapper and template etc. Do I still need to do this or is there an easier way without having to go through a mapper and template again?

Ok so I think I’ve figured this but struggling to get the metadata for the barcode out in a script:

So I want to get the value for Barcode_1_Value and using the below:

var BarcodeValue = metadata.Job().Group(0).Document(docIndex).Datapage(0).FieldByName(“_vger_fld_Barcode_1_Value”);

I’ve never extracted metadata from the datapage level so not sure if the syntax is correct? But I’m not getting any value returned with this code