cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SylvieLet17
Responsive Resident
Responsive Resident

Adobe Merge PDFs from Array

Hi all,


I have a Flow that gets attachments from a SharePoint list, creates PDFs out of them using the Adobe convert image to PDF action. The number of list items and attachments will vary. 

Now I need to use the Adobe Merge PDFs action to merge all of these PDFs. 

It needs to be dynamic. 

I've tried adding the file contents to an array like in this guide and then dropping the array into the File Content part of the Merge PDFs, but I get the error:
"For application/pdf mime-type The input file appears to be corrupted and cannot be processed."

Has anyone done anything similar?

2 ACCEPTED SOLUTIONS

Accepted Solutions
SylvieLet17
Responsive Resident
Responsive Resident

Looks like it was an issue caused by an earlier step in my flow, the action is now working properly. 

View solution in original post

timbo23
Frequent Visitor

Hi SylvieLet17,

Thanks for your answer.  It was a help, and got me a long way down the road.  I found a solution which seems to work now and I'll put it into production tomorrow.

I don't seem to have permission to upload a photo, so let me try to explain what I did:

1.   After getting the file content, I set the value of my first "Append to array" command to be the "File Content" dynamic content item.

Append1.JPG

 

2.  Then, after getting the file content for the subsequent files, I had to set the value of all subsequent "Append to array" commands to include the base64 function like this:

Append2.JPG

 

Note - the expression for the "$content" comes from the expression builder, and is actually:  

trim(base64(outputs('Get_file_content')?['body']))
 
The catch was that I had to use both the 'trim()' and the 'base64()' expression in the JSON. 
  • The base64() expression solved the issue of the subsequent PDF files being merged in as blank pages (i.e. i struggled with an issue where the first doc merged fine, but all subsequent docs were just blank pages).
  • The trim() expression solved the issue of the base64() dissapearing when I went back into the flow to check, edit and test it.
The actual MergePDF command was as simple as you show it, and I can then use the output either on sharepoint or attach it to an email.
Final1.JPG
 
Thankyou for your help.

View solution in original post

8 REPLIES 8
ChristianAbata
Super User II
Super User II

hi @SylvieLet17  you can find here some options

Solved: Merging two pdf files - Power Platform Community (microsoft.com)

Solved: Merge PDF Files - Power Platform Community (microsoft.com)



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

Thanks Christian, I won't be getting a subscription, and I need a sustainable solution so no free trials. I will look at the Cloudmersive tool, but specifically wondering if anyone has experience with the Adobe action, since it seems to be capable of accepting arrays and I'd rather use the actual Adobe tool.

Thanks again.

SylvieLet17
Responsive Resident
Responsive Resident

Looks like it was an issue caused by an earlier step in my flow, the action is now working properly. 

View solution in original post

timbo23
Frequent Visitor

Hi SylvieLet17, I'm running into the same issue. Would love to connect with you to learn how you were able to use the Adobe Merge PDF from Array too.  Could you share how you constructed your array please?  Thanks.

SylvieLet17
Responsive Resident
Responsive Resident

Hope this helps:

mergePDFs.pngmergePDFs2.png

timbo23
Frequent Visitor

Thanks - helpful to guide how to construct the array.  I'm still getting the same error unfortunatley.  What was the issue you noted earlier in your flow?  Maybe it's the same for me too...Thanks.

SylvieLet17
Responsive Resident
Responsive Resident

Hey timbo23, sorry this took me so ridiculous long to answer...things get in the way you know?

I JUST fixed it properly (I think) :

 

mergePDF.pngmergePDF2.png

Basically - try adding the "$content-type=application/pdf" part and the curly brackets. That should work

timbo23
Frequent Visitor

Hi SylvieLet17,

Thanks for your answer.  It was a help, and got me a long way down the road.  I found a solution which seems to work now and I'll put it into production tomorrow.

I don't seem to have permission to upload a photo, so let me try to explain what I did:

1.   After getting the file content, I set the value of my first "Append to array" command to be the "File Content" dynamic content item.

Append1.JPG

 

2.  Then, after getting the file content for the subsequent files, I had to set the value of all subsequent "Append to array" commands to include the base64 function like this:

Append2.JPG

 

Note - the expression for the "$content" comes from the expression builder, and is actually:  

trim(base64(outputs('Get_file_content')?['body']))
 
The catch was that I had to use both the 'trim()' and the 'base64()' expression in the JSON. 
  • The base64() expression solved the issue of the subsequent PDF files being merged in as blank pages (i.e. i struggled with an issue where the first doc merged fine, but all subsequent docs were just blank pages).
  • The trim() expression solved the issue of the base64() dissapearing when I went back into the flow to check, edit and test it.
The actual MergePDF command was as simple as you show it, and I can then use the output either on sharepoint or attach it to an email.
Final1.JPG
 
Thankyou for your help.

View solution in original post

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Users online (73,996)