Suggestion: Try writing the file data out without using Base64Util - and then examining the contents of the file with a text editor - if you are able to share this - please attach the file to the post here and we can take a look.
I tried to write the file without decoding it to base 64 into a text file.
But after opening the file in NOTEPAD++ ,I can see the content of file is in Binary form(like- JVBERioXLQKsJKDKNgdtb5NM86wk...).
Because of restrictions i can not share the file.
Just a info that when i used the send file method i am getting the proper fie and there are no issue when i was tried to open that file.The issue with that method is that it save's file in servie export directory but i want to save my file into a specific directory.