Merge PDFs from Sharepoint (Dynamic Page Count)

New Here ,
Jun 01, 2021 Jun 01, 2021

Copy link to clipboard

Copied

Hello,

I have a Sharepoint folder with several PDF files within. I would like to collect the file content from each of those files, create an array variable with the merged file content, and then pass that variable into the Adobe Merge PDFs array input.

I have tried appending the file content in several ways but keep running into an error where 'the input file appears to be corrupted'.


Here is the flow:

Merge Flow.png

 

And here is the error I get on the Merge PDFs step:

 

Body

{
  "error": {
    "code""OperationException",
    "message""For application/pdf mime-type The input file appears to be corrupted and cannot be processed.; transactionId=VQTDOIyZ0GELGsBTn906mdWut90RjQ9z-PowerAutomate"
  }
}
 
Header
{
  "Transfer-Encoding""chunked",
  "x-request-id""Y9eiSoQ79xzw8YXf3r1QWkptSGVuFD2q",
  "pragma""no-cache",
  "x-content-type-options""nosniff",
  "strict-transport-security""max-age=31536000; includeSubdomains",
  "x-robots-tag""noindex,nofollow",
  "vary""accept-encoding",
  "Timing-Allow-Origin""*",
  "x-ms-apihub-cached-response""true",
  "Cache-Control""no-store, must-revalidate, no-cache",
  "Date""Tue, 01 Jun 2021 20:33:28 GMT",
  "Content-Type""application/json",
  "Expires""Thu, 01 Dec 1994 16:00:00 GMT",
  "Content-Length""232"
}
 
Status Code
400
 
I am able to successfully merge these files when I individually retrieve the file contents and use the detail inputs instead of array inputs. 
 
Below is the beginning of one of the inputs. I believe the issue is in the bolded text, but I don't know how to append file content to my array variable without it as it has to be a valid JSON. I've attached the entire inputs for both a successful run (using detail input) and failure (using array input) for reference. It looks to me like that bolded part is the only difference.

{"host":{"apiId":"subscriptions/34eedfbf-3e33-475d-b510-23537fba3dc9/providers/Microsoft.Web/locations/canadacentral/runtimes/Canada-001/apis/adobepdftools","connectionReferenceName":"shared_adobepdftools","operationId":"CombinePDF"},"parameters":{"Files Array/outputFileName":"Package.pdf","Files Array/files":[{"$content-type":"application/pdf","$content":{"$content-type":"application/pdf","$content":"JVBERi0xLjcNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFuZyhlbi1VUykgL1N0cnVjdFRyZWVSb290IDE0IDAgUi9NYXJrSW5mbzw8L01hcmtlZCB0cnVlPj4vTWV0YWRhdGEgMTQ1IDAgUi9WaWV3ZXJQcmVmZXJlbmNlcyAxN

 

Any help would be greatly appreciated.

Views

112

Likes

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 30, 2021 Jul 30, 2021

Copy link to clipboard

Copied

LATEST

Hi, 

 

In the "Append to array variable" Connector, please put the Value as $(File Content) instead of 
{
"$content-type":"application/pdf",
"$content":$(File Content) 
}
because the $(File Content) already contains the "$content-type" and "$content" properties.
 
Here is the screenshot for reference. Screenshot 2021-07-30 at 2.55.13 PM.png

Likes

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