Error with PDF Merging Power Automate

Hi,

I am having an error while running one of my flows on Power Automate :

I followed this tutorial (How to merge PDF files in Power Automate (Microsoft Flow), Azure Logic Apps, and PowerApps — Plumsail Documents Documentation) and created the exact same elements (Array variable, then 'Apply to each' action etc.)
On a Test Sharepoint

When I run it, it works correctly

However, when i create the exact same flow but in my real Sharepoint

When i run it, I get this error message :

I saw an other topic having the same problem, but even with deleting the brackets, the error still appears.
I don't understand why does it work correctly with the first flow, but not with the second one ?
I am currently on a Trial version, maybe the use is limited to one flow ?

Thank you,
Alexandre

Hello @amvf,

The trial version has the same functionality as the full one, no limitations.
When you run it on the test SharePoint I see this number in the apply to each section

it means that 3 files were added to the array.

Could you confirm how many iterations were done with the second flow?

I suspect the second array has either 0 or 1 PDF file inside.

Best regards,
Petr
Plumsail team

Hi,

I use the same folder for the two flows, it contains 3 PDF :


I put this folder in the Sharepoint, and it seems that the second flow does 0 iterations

Before this action, I use the block 'Get files (properties only)'

in which i limit the entries to the full path of my Folder (in the two flows), as there is a new folder created for each run.

Thank you,
Alexandre

Hi @amvf,

If the second flow has 0 iterations then the array is empty and the Merge PDF action gives this error.

Make sure to pull all the PDF from the source folder on the previous steps.

Best regards,
Petr
Plumsail team

Hi,

Thank you for your answer. Yes, it seems that the problem is on the "Apply to each" Loop. I made two other flows focused on this step, one on the Test Sharepoint, and the other on the real Sharepoint.

For the Test sharepoint, it runs correctly,

And for the real Sharepoint, there is still this 0 iteration Loop

Is there a parameter (depending on the Sharepoint server) that restrict the use of this loop ? I can't figure out why there is this difference on two identical flows.
Let me know if you have a solution for this.

Thank you,
Alexandre

Hi @amvf,

The Apply to Each section number of iterations depends on the value from the previous SharePoint action Get files (properties only).

So, if the number of iterations is 0, then probably the previous actions returned 0 files from the specified folder.

Check if the previous action Get files (properties) only returns any number of files, check the folder path there as well.

Best regards,
Petr
Plumsail team

Hi,

Thank you for your help ! I finally figured out the problem, which comes from the Get files (properties) action, as you suggested.
Depending on the Sharepoint server, this action must be configured to work correctly :

The real Sharepoint has an important amount of documents, whereas the Test Sharepoint does'nt have that much, so I put the 'Include Nested Items' to "No". Even though I restrict the files to one folder, I must make this configuration.

After that, the flow recognizes the 3 pdf files in my folder, and merge them.

There is an other parameter that could also fix the problem, it's the "Top count", when there is more than 100 files concerned by the action. This parameter can be changed up to 5000.

Thank you for your help

Kind regards,
Alexandre

1 Like

Hello, for my case, I am merging 3 PDFs. No nested documents. Using the same tutorial as the original author. used compose to just log the outputs after get file. The iteration of apply to each is working but it still throws the same error
"The converter 'Plumsail.Actions.Api.Services.Json.TypeConverters.FlowListByteArrayConverter' read too much or not enough. Path: $.documentsContents | LineNumber: 0 | BytePositionInLine: 285505."



Immediate help needed!
Thanks

Hello @parv,

I tested this example and the flow works ok.

Check the following in you flow

  1. Make sure you switched the Merge PDF action to apply the array:

This input for individual files, not arrays:

image

  1. Make sure you add only PDF files from the SP folder. Check the SharePoint "Get files (properties only)" settings.

  2. I'd remove the compose function to simplify the flow and isolate the issue. Then add it back after fixing it.

Please let us know if it helps. If not, share your flow in Edit mode with all the actions settings.

Best regards,
Petr
Plumsail team

Hey @Petr ,

I started working without me doing any changes to the flow. So I don't know what exactly the issue was. If you want to look more into it, I would happily provide the work flow.

1 Like

Hi @parv,

Hopefully, this will work without any issues now.
Please share the flow details if you notice any new errors.

Best regards,
Petr
Plumsail team

Hi Petr

Am having the same error



Hi @Kelvin_Mureti,

  1. Please make sure you collected only PDF files from the SharePoint folder. There could be some other files, like images or documents, etc. I see no filter in the Get files action.

In most cases, the array probably contains non-pdf files.

  1. What is the error message? I only see the ActionFailed message without the details on the screenshot.

Best regards,
Petr
Plumsail team

Hi,
Was this resolved? I have a similar setup merging PDF files created by the Plumsail 'Create document from XLSX template' action and I get the error: 'Merge_PDF' failed: The converter 'Plumsail.Actions.Api.Services.Json.TypeConverters.FlowListByteArrayConverter' read too much or not enough. Path: $.documentsContents | LineNumber: 0 '

Thanks,
Dave

Hi @dave.nicholls,

I tested the scenario when two XLSX files were created from templates, converted to PDF and then merged. It worked ok, and I can't confirm that there is a general issue or bug with the Merge PDF action at the moment

merged-pdfs.pdf (19.3 KB)

Could you try saving the generated PDF files individually and share them with us for testing?
Please also include a screenshot of your flow with all the details.

You can send the information to our HelpDesk at support@plumsail.com with a reference to the thread.

Thanks!

Best regards,
Petr
Plumsail team

Thanks Petr,
I think part of the issue us that I am trying to create a report that will have a dynamic number of pages based on the number of images that are being imported into the report.

I have the Create from XLSX action within a Do Until container and after the create append the file contents to an array. After the Do Until I have then been using the 'advanced' JSON mode of the Merge PDF to insert the array of pages for it to merge, but that's where I seem to be having issues.

Testing it with only 2 pages and using the basic method for merging as you outlined I can successfully get the pages to merge.

I have also tried your suggestion of saving as individual files during the Do Until loop but then I need to bring them back into the flow and add to an array again for merging and this causes the same error.

Thanks,
Dave

Hi @dave.nicholls,

To advise further on the matter, I'll need to check your flow screenshots and the generated PDF files. Please also share a screenshot with the error message.

Could you send the information to our HelpDesk at support@plumsail.com with a reference to the thread?

Best regards,
Petr
Plumsail team