How to Split PDF file if actual file size is greater than 5mb

Hi guys,

I Have one scenario where I am merging multiple PDF files into one PDF file.
Multiple files
image

into One File
image

now, robot should check if “New.pdf” file is
less than 5mb then
“process further”
Else
split file

I am stuck at Else block “Split File

Kindly suggest…!

@Palaniyappan
@sarathi125
@AshwinS2

Hi @Assetsoft

Try this

Thanks
Ashwin S

Thank!

Thanks
@AshwinS2
@kadiravan_kalidoss

This is quite confusing. Lets say if split into ranges 1-4,…40-45.
what if 1-4 file size is greater than 5mb ?

I think this will not work in my case. because now there is possibility to have more than 50+ files.

is there any way to check length of files and then join accordingly ?

Thanks

@sarathi125

@Assetsoft,

While merging pdf files get the pdf files which are all has total size below 5MB then merge those alone

@sarathi125

there you are.!!

What I need to do for same ??

could you please elaborate more ?

@sarathi125
@AshwinS2
@Palaniyappan

Hi guys,

Please suggest …!!!

@Assetsoft,

Check this xaml, Used linq query inside invoke code.

It will return List(Of List(Of Fileinfo)), so you can merger the files by lists

SplitFilesBasedOnSize.xaml (9.4 KB)

1 Like

Hi @sarathi125

I just folder path to “strDesktop” variable
and getting below output.

image

@Palaniyappan
@HareeshMR

@Assetsoft,

Then I think those 6 PDFs files total size may be less than 5MB and those are only the files in that directory?

1 Like

@sarathi125

now I inserted 20mb pdf file in same location

image

so it is grouping now ?

my next step should be inside body ?

Sorry bro but honestly I am not getting it.:sweat_smile:

kindly advise.

Thanks @sarathi125

@Assetsoft,

Yes, In the Inner For Each loop you need to merge the list of files available in that as a PDF.

Thanks @sarathi125

This what i did

But output of this is highlighted in red below “new.pdf”
image

If I am not wrong here we are not calculating sum of file size. Right?
because file name “ef1710en.pdf” size = 4655kb and

I think we need sum of file size and group them and then merge or join group wise into one file ?

Please correct me and suggest me.

Thanks,

@Palaniyappan
@HareeshMR

@Assetsoft,

The files are grouped into List(Of Fileinfo), so you need to pass that to the Merge PDF activity as shown below.

Thanks Once again @sarathi125 @Palaniyappan

2 Likes

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