I want to Merge 2 PDF files. 1 PDF contain 1st page of details and 2nd PDF contains other details

I want to Merge 2 PDF files. 1 PDF contain 1st page of details and 2nd PDF contains other details.

Can somebody please help.

I have a plan but not sure if it will work.

In an excel I can give 1st file path & second file path But need a way to build a loop around it.

Hey @Raks_K

Goto Manage Package Add → below mentioned package with same version

image

Then in Activity Panel–> Search for Merge PDF → Drag it to Designer Canvas → It will automatically add one more package →

image
Then → Add Two PDFs using Add Entry button.

Screenshot for your reference:

If you want to add Pdf’s path dynamically then,

Click on Use Collection of Pdf Files,

Then,
Put below mentioned Query:

Directory.GetFiles("Your\Folder\Path","*.pdf").Select(Function(x) LocalResource.FromPath(x.ToString)).ToArray

Note: Replace Your\Folder\Path in the above query with the source folder path which has pdfs in it!

Screenshot of Variable panel for your reference:

Or

Refer this

Hope all the above-mentioned information will help you!
If Yes, then kindly mark this post as a Solution.

Happy Automation!

Regards,
Ajay Mishra

One PDF is in one folder, another PDF is in another folder.

I want the bot to pick the first pdf & pick the right pdf from second folder & then Merge

@ashokkarale can you please advise?

@Raks_K

Okay so you have 2 folders then use below mentioned query in my above solution:

{LocalResource.FromPath(Directory.GetFiles("Your\1stFolder\Path","*.pdf").First),LocalResource.FromPath(Directory.GetFiles("Your\2ndFolder\Path","*.pdf").First)}

If you want to join only to pdfs then use above query.

And If you want to join multiple pdfs from two different folders:

Directory.GetFiles("Your\1stFolder\Path","*.pdf").Select(Function(x) LocalResource.FromPath(x.ToString)).ToArray.Concate(Directory.GetFiles("Your\2ndFolder\Path","*.pdf").Select(Function(x) LocalResource.FromPath(x.ToString)).ToArray).ToArray

Note: Replace Your\Folder\Path in the above query with the source folder path which has pdfs in it!

Regards,
Ajay Mishra

image
Getting an error

Hi @Raks_K

Try this

{File1,File2}

Regards,

It is not merging as it should

@Raks_K

It creates a new file and adds that 2 files into it.

Cheers!!

@Raks_K

Hey,

You have passed it in Double quotes, why so?

And also it’s better to show the error message.

I didn’t passed any quotes here:

Regards,
Ajay Mishra