How to use barcode as batch separators when saving images?

To use barcode as separator and save the scanned documents into different files, you can check each page and see if it contains a barcode and save the files accordingly.
Below please find a simple sample of using Dynamic .NET TWAIN with the Barcode Reader Add-on to accomplish the task. You can put the code in the OnPostAllTransfers event, which fires after all images scanned, to trigger the process automatically after scanning.

 List<IndexList> listImageIndex = new List<IndexList>;();
IndexList listIndex = null;
       
for (int i = 0; i &lt; this.dynamicDotNetTwain1.HowManyImagesInBuffer; i++)
{
if (null == listIndex)
listIndex = new IndexList();
Result[] aryResult = this.dynamicDotNetTwain1.ReadBarcode((short)i, BarcodeFormat.CODE_39);//Please update the barcode format to yours

if (null == aryResult || aryResult.Length == 0)
{
listIndex.Add(i); //If no barcode found on the current image, add it to the image list for saving
}
else
{
if (listIndex != null && listIndex.Count > 0)
{
listImageIndex.Add(listIndex);
listIndex = null;
}

//If a barcode is found, restart the list
listIndex = new IndexList();
listIndex.Add(i);
}
}

if (listIndex != null)
{
listImageIndex.Add(listIndex);  //save a last set of data
listIndex = null;
}


int index = 0;
foreach (IndexList list in listImageIndex)
{
if (list.Count != 0)
{
this.dynamicDotNetTwain1.SaveAsMultiPagePDF(@ "D:\temp\DNT\" + index + ".pdf", list);
MessageBox.Show(this.dynamicDotNetTwain1.ErrorString);
}

index++;
}