I was able to flatten XDPs into a single PDF successfully using the invokeDDX.
The issue that I am facing now is while merging 4 forms together, if the 2nd or 3rd form happens to be in Landscape orientation, all rest of the forms also convert to the Landscape orientation. Also, when I try printing it, the Printer says the Printer Size did not match Paper type or something of that sort. Following was my DDX:
How do I get forms with different orientations to assemble and print? Would appreciate any help in this regard.