• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Merging multiple documents to PDF using Microsoft Flow getting error "For application/pdf mime-type"

Community Beginner ,
Apr 14, 2021 Apr 14, 2021

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  : 

  1. Flow trigger. (manually)
  2. Get files (properties only) We start with getting properties of all our DOCX files stored in a specific folder - Source Files Library. ...
  3. Initialize Array variable. ...
  4. Get file content using path. ...
  5. Convert DOCX to PDF. ...
  6. Append to an array variable. ...
  7. Merge PDF. ...

 

MAla5C4D_0-1618402410246.pngMAla5C4D_1-1618402768656.png

MAla5C4D_3-1618402833763.png

 

Full Flow : 

MAla5C4D_2-1618402808619.png

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.

TOPICS
PDF Services API , Power Automate

Views

4.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Apr 14, 2021 Apr 14, 2021

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:

https://community.adobe.com/t5/document-services-apis/power-automate-split-and-merge-the-split-outpu...

This is a common in many Power Automate scenarios. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 14, 2021 Apr 14, 2021

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:

 

MAla5C4D_0-1618419225924.png

but still getting the same issue .

MAla5C4D_1-1618419326878.png

 

Please help me on the above issue. Awaiting your response!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 18, 2021 Apr 18, 2021

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.

Capture.PNG

Capture.PNG

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Apr 18, 2021 Apr 18, 2021

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. 

2A2EF7BC-34E2-457B-80B0-BFB57D8C77A4.jpeg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 19, 2021 Apr 19, 2021

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!

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 18, 2021 May 18, 2021

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:

  • Absolutely sure that you are passing all PDF documents to Merge PDF action? If not, then you need to convert beforehand. 
  • Make sure your $content-type is application/pdf. If it isn't, Merge PDF will reject it. 
  • You can't just pass the file content into the array because Merge PDF is strict that it will only accept $content-type and $content in the object.

 

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?

 

2021-05-18_15-54-12.png

2021-05-18_15-46-32.png

  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 24, 2021 May 24, 2021

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…………… "}]

 

MAla5C4D_1-1621869308136.png

 

but still getting the same error 

 

MAla5C4D_0-1621869017807.png

 

So please suggest if still I am missing something which is causing this error.

 

Thanks 

Mala

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 14, 2022 Apr 14, 2022

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 20, 2022 Jul 20, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 17, 2022 Nov 17, 2022

Copy link to clipboard

Copied

did you end up solving this issue?

i'm having the same problem.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 05, 2023 Jan 05, 2023

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

Soumyadeep278166409rcc_0-1672936831914.png

After this feeding that array to MergedPDF action. Below is what I am getting in array variable

Soumyadeep278166409rcc_1-1672936924088.png

 

Can you please help/guide further. Looking forward to your response

 

Regards,

Soumyadeep

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 05, 2023 Jan 05, 2023

Copy link to clipboard

Copied

I am able to fix the issue

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 20, 2023 Feb 20, 2023

Copy link to clipboard

Copied

@Soumyadeep2201  Can you please explain how you fixed this issue?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 17, 2023 Jun 17, 2023

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 24, 2023 Jul 24, 2023

Copy link to clipboard

Copied

LATEST

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources