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

11 REPLIES 11
ChristianAbata
Community Champion
Community Champion

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. 

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.

Dear Expertise/ Specialist, @SylvieLet17 @timbo23 

 

I have encountered the flow error with message “For application/pdf mime-type The input file appears to be corrupted and cannot be processed.” On the Flow of “Adobe Merge PDFs”.  And having the similar problem. I would greatly appreciate it if you could share your successful scenario.  Much Obliged.

 

I have 2 Tables/ Lists and the flows below:

  1. From ‘Table 1’, I use Do-Loop to extract the Attachment from multiple records I needed. 
  2. After that, I use “Adobe Convert Doc to PDF” function to convert the (1) Attachment from multiple records to SAVE it ALL to a single raw record in ‘Table 2’. And the Loop function ended.
  3. Then,
    1. I get the Raw Record from ‘Table 2’
    2. Get Attachment
    3. Get Attachment Content
  4. Based on (3) result, I append it to the array Variable “varPDF”
  5. I called the “Adobe Merge PDFs” function and attach the “varPDF” to it for merging, then I could save it back to my Database.

 

happyccy_0-1649740877092.png

 

happyccy_1-1649740909479.png

happyccy_2-1649740936765.png

 

 

 

happyccy
Helper I
Helper I

I would very appreciate your help.  Best.

happyccy
Helper I
Helper I

Or Would you please share how the appropriate parameters that "Merge PDF" API accept.  Much obliged.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,247)