Spark writing output as fixed width

Reading a fixed-width file into Spark is easy and there are multiple ways to do so. However, I could not find a way to WRITE fixed-width output from spark (2.3.1). Would converting a DF to RDD help? Currently using Pyspark but any language is welcome. Can someone suggest a way out?