cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LabheshPower
Frequent Visitor

Power Automate Desktop - PDF Merge Functionality - Need logic to merge PDF

Hello Team, 

 

I need your help with a logic to merge muliple PDF files based on a condition and below is the scenario. 

LabheshPower_0-1617976550114.png

 

 

I have a list of PDF files each 1 page report, a Total of 200 PDF files in a single Folder.

 

There are few PDF which report content is extended to next file or next file, which means that all PDF are not for single report. There are scenarios where merging 2 or 3 PDF together will make a single client file.  And that is where I need help with logic to apply.

 

These are PDF files

LabheshPower_1-1617976924559.png

 

In Power Automate Desktop, I need a logic by which I should be able to Merge

1) File 5 and 6 PDF

2) File 9, 10 and 11 PDF

 

Currently I am using Files in Folder loop, and able to navigate to each file 1 by 1, but I am unable to find a logic by where In that file folder loop, I can merge current and next file as well. 

 

Power automate provide a feature to merge 2 files, but how to implement that logic is  a key? 

LabheshPower_2-1617977114820.png

 

 Kindly help, if you can.

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
fraenK
Super User
Super User

So the condition is "no footer" in the filename?

Then you just check in the loop if the next filename(s) in the list contain the text until there isn't.

Use the resulting list as an input for merge pdf.

Set you list counter variable to the next not used PDF file in the main list. 

View solution in original post

LabheshPower
Frequent Visitor

 let me give more info. 

LabheshPower_0-1618272940182.png

 

LabheshPower_1-1618272987214.png

 

View solution in original post

4 REPLIES 4
fraenK
Super User
Super User

So the condition is "no footer" in the filename?

Then you just check in the loop if the next filename(s) in the list contain the text until there isn't.

Use the resulting list as an input for merge pdf.

Set you list counter variable to the next not used PDF file in the main list. 

View solution in original post

LabheshPower
Frequent Visitor

 let me give more info. 

LabheshPower_0-1618272940182.png

 

LabheshPower_1-1618272987214.png

 

View solution in original post

vedkumar
Regular Visitor

Hi ,

 

while using fix file name in merge pdf files, path like below:

%['D:\\Bank Mail\\ENBD\\15 Sep 2021\\ENBDLA21007137\\ENBDLA2100713781631621881127960COVER_LETTER_NEGO.pdf', 'D:\\Bank Mail\\ENBD\\15 Sep 2021\\ENBDLA21007137\\ENBDLA2100713781631621881229842COVER_LETTER_NEGO_COPY.pdf']%

 

"\\" is there in path 

 

But when i am using variable , it has only "\".  if i store the path in  variable , it does not work.

 

 

shindomo
Continued Contributor
Continued Contributor

Hello @vedkumar,

 

I have tried below sample flow, and it runs without any problems.

Could you show us the details of your issue?

 

shindomo_0-1632096414195.png

SET SourceFiles TO ['C:\\Users\\User01\\Documents\\PDF Document 01.pdf', 'C:\\Users\\User01\\Documents\\PDF Document 02.pdf']
SET MergedFile TO $'''C:\\Users\\User01\\Documents\\PDF Document Output.pdf'''
Pdf.MergeFiles PDFFiles: SourceFiles MergedPDFPath: MergedFile IfFileExists: Pdf.IfFileExists.Overwrite PasswordDelimiter: $''',''' MergedPDF=> MergedPDF

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (1,946)