Dynamic array in Join PDF activity

Hi,

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.

Hi @John_Raj

Can you try the below

Sequence21.xaml (15.2 KB)

Regards,

1 Like

why do you use the totalBatches variable

@John_Raj

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.

Regards,

1 Like

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)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.