Found the root cause of it, there is no issues with above piece of code. Before that we were trying to Read the data form the stream using Read() without specifying the length. While reading for the first time data is getting truncated leaving PDF file corrupted and truncated.
- Log in to post comments