I have a folder with PDFs and need to combine it to a single PDF file. If the folder has more than 50 PDF there should be another Combined PDF created.
Like if the folder has 120 PDF files - need to create three combined PDF files with 50, 50, 20 PDFs on each combined file.
Can use the Join PDF activity, but how can i apply the logic to separate the files with 50 each PDF files.
How can i approach and solve this.
The totalBatches variable is typically used when you want to know how many total batches you’ll be working with, but since you don’t explicitly need it for processing, you can remove it and simplify the flow.
batches = pdfFiles.Select(Function(file, index) New With {file, index}).
GroupBy(Function(x) x.index \ batchSize).
Select(Function(group) group.Select(Function(x) x.file).ToList()).
ToList()
This will create the batches of 50 and if less than 50, that number. You can loop through the list and then join each batch into individual pdfs.
batchSize=50
pdfFiles= Directory.GetFiles(Folder)