Hi @Murli_Manohar,
I guess this issue you need explore on your own. The forum can only help you with way to get to your solution and cannot offer a 100% working solution (atleast not for complex automations).
-
Your use-case in the question was for PDFs sizes over 5MB right? Why dont you filter out PDFs under 5 MB first, that way you do not need to reduce their file size. You will save robot execution time and avoid this failure altogether.
-
Also adding a sequence to check if the output.pdf has no characters will be necessary if you continue to use the suggested approach on smaller file sizes.
As per the reason for blank pdfs, there are bunch of similar questions in stackoverflow / ghostscript forum dating from 2008 to 2019, which you can study.