Showing results for 
Search instead for 
Did you mean: 
Not applicable

"Merge PDF Files" Acton - Error (Object reference not set to an instance of an object.)

Hi Community 


I am facing an issue while merging two PDF files through Power Automate Desktop. Can anyone help?


Error:Microsoft.Flow.RPA.Desktop.Robin.SDK.ActionException: Failed to merge PDF files: 'C:\Users\Umar.Shahzad\Desktop\Registry6.pdf', 'C:\Users\Umar.Shahzad\Desktop\Registry3.pdf' ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Flow.RPA.Desktop.Modules.PDF.Actions.PDFium.PDFium.FPDF_SaveAsCopy(IntPtr doc, FPDF_FILEWRITE writer, Int32 flags)
at Microsoft.Flow.RPA.Desktop.Modules.PDF.Actions.MergePDFFilesAction.Execute(ActionContext context)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.PDF.Actions.MergePDFFilesAction.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)


Screenshot 2022-01-20 150916.png

Helper III
Helper III

Not sure, I tried same way and no problem.


Also, I read some tips that upload the files into web for PDF to do that.

It might be another way to automatic.

Not applicable

Thank you Benny_1857


Let me explain in detail. 


I use the action "Merge PDF Files" and use it to merge two files, namely Registry 1 and Registry 2. The process runs successfully but in the merged file Registry 2 comes as first page Registry 1 as second despite the fact the sorting is ascending. I want to Registry1 to become the first page. So I thought it may be due to sorting. So I changed the sorting to descending and run. However, this time the process goes in error and produces the error in my first message. No matter what I do I am unable to make registry 1 as first page. Can you please test this at your end and let me know if you end up in the same error. 



Super User
Super User


Pease refer this, for me it was working.

Not applicable

Thanks Ahammad. Can you please check the page order in which they were merged. I also messaged earlier a bit in detail. Were you able to reproduce the issue by changing the sort order?

Helper III
Helper III

When I get the files from folder, I set the accending sort by FullName in advanced. 

It works.

Not applicable

Thanks. For some reason it is not working for me.

I am not sure. I just guess whether it is because of sort by text?

For example sort 3 file name acceding. A2.PDF,A3.PDF,A12.PDF
After sort it will be A12.PDF,A2.PDF, A3.PDF

Not applicable

Sorting is perfectly working fine. But merge is not merging according to sort order. If I select ascending it merges fine but in descending order. If I select descending it goes into error. 

Resolver I
Resolver I


I tried too and no problem for me.


Have you the last version of PAD?

Helpful resources

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.

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.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Top Solution Authors
Top Kudoed Authors
Users online (3,535)