Copy link to clipboard
Copied
Hey, My requirement is to merge multiple document into pdf using Microsoft Flow but every time getting error ("For application/pdf mime-type The input file appears to be corrupted and cannot be processed.;...-PowerAutomate").
Below are the step which implemented in my flow with screenshot :
Full Flow :
Please let me know how I can merge multiple document into single pdf using Adobe Connector from Microsoft Flow. Currently using the above flow getting error ("For application/pdf mime-type The input file appears to be corrupted and cannot be processed.;...-PowerAutomate") but the document are not corrupted.
Copy link to clipboard
Copied
Have a look at the solution in this thread about creating an object to pass the content type and file content:
This is a common in many Power Automate scenarios.
Copy link to clipboard
Copied
Thank you so much for the reply. After implementing content type in array still getting the same issue . Below is the screenshot:
but still getting the same issue .
Please help me on the above issue. Awaiting your response!
Copy link to clipboard
Copied
Hi,
I am having a similar issue when trying to merge seveal documents which i am accessing with the sharepoint "Get file content" card.
I have created and array to which i am appending
{
"$content-type": @{body('Get_file_properties_2')?['{ContentType}']?['Name']},
"$content": @{body('Get_file_content')}
}
however i am returning a "Bad Gateway" error on the Adobe "Merge PDF's" card.
Im assuming there is some issue with the format that is returned by the sharepoint card not being what is expected by the Adobe card.
Copy link to clipboard
Copied
It looks like you are inserting an array object into an individual item. Click the Button in the image attached to switch to JSON data mode and then clear everything and set your array variable.
Copy link to clipboard
Copied
Hi Ben,
I am deffinately working with the JSON type editor, as the individual item shows "File 1, File 2, File n, etc."
Additionaly, the "File content" from the Get File Content card returns a 2D array which has
"$content-type"
&
"$content"
as its elements.
The array created in the image above "Append to array variable 8" returned,
{"$content-type":"Document Library","$content":{"$content-type":"application/pdf","$content":"JVBERi0xLj~"}}
which im assuming is not correct.
I have changed the array i am inputting into the "Merge PDF" card (resulting in the below structure), but am still receiving a "Bad Gateway" error.
Can you tell me the syntax expected by the "Merge PDF" card is?
Does it expect
[
{
"$content-type":"application/pdf",
"$content":"JVBERi0~"
}
{
etc.
}
]
or is there some issue with the syntax of the "$content-type" element ("application.pdf" maybe?)
Thankyou for your help!
Copy link to clipboard
Copied
Hi @Thomas5C18 ,
I tried to replicate your type of flow locally. It seems to be working on my end. A few things:
Below is an image to help illustrate an example that is working. It seems like it is probably something little like a wrong mime-type or something else. Out of curiosity, check to see if you write the content type static, does it make a difference?
Copy link to clipboard
Copied
Hi @beni ,
Thanks for your response. I have gone through your solution and compared with the steps which I have followed to merge the PDFs. Please find below array outcome which I passed in merge PDF function which you also suggested.
[{"$content-type":"application/pdf","$content":"JVB............. "},{"$content-type":"application/pdf","$content": "JVB…………… "}]
but still getting the same error
So please suggest if still I am missing something which is causing this error.
Thanks
Mala
Copy link to clipboard
Copied
Hi Mala,
I notice your post and would like to share with you.
Have you solve it already?
Best regards,
Likar
Copy link to clipboard
Copied
Do you have a document you might be able to private message? Since I can't recreate the issue, it makes me wonder if there is something with the file.
Copy link to clipboard
Copied
did you end up solving this issue?
i'm having the same problem.
Copy link to clipboard
Copied
Hi @Ben Vanderberg ,
I am also facing the same issue where MergedPDF is throwing the input file error for application/pdf MIME type. I am passing the pdf file name from PowerApps to Power Automate then getting the file content from SharePoint connector and appending to array variable
After this feeding that array to MergedPDF action. Below is what I am getting in array variable
Can you please help/guide further. Looking forward to your response
Regards,
Soumyadeep
Copy link to clipboard
Copied
I am able to fix the issue
Copy link to clipboard
Copied
@Soumyadeep2201 Can you please explain how you fixed this issue?
Copy link to clipboard
Copied
So, i ran into the same problem and after a night of suffering i think i found the solution: the problem i had (and most of the solutions posted here have) is that we left the square brackets around the array variable name when importing it in the "merge PDF" step. Yep, it's that simple: remove the square brackets arounf your variable and it will work. It makes sense because your variable already is an array; by adding more brackets you are basically telling the system that it is a bidimensional array (wich it's not). Remove brackets and it works
Copy link to clipboard
Copied
Yes, this was the problem!
The solution was already mentioned (https://community.adobe.com/t5/acrobat-services-api-discussions/merging-multiple-documents-to-pdf-us...) but I guess the "hidden" brackets are at fault here. I checked and I said "there are no brackets" but then I double checked and yes, there they were (again, https://community.adobe.com/t5/acrobat-services-api-discussions/merging-multiple-documents-to-pdf-us...). Thank you for this comment, it helped me solving the issue!