|
Rank: Newbie Groups: Member
Joined: 2/21/2016 Posts: 8
|
Hi Team,
I am trying to create pdf document from the stream. But I am getting the following error.
"Error parsing input stream at offset 2362017. Expecting 'New line' but end of the file reached."
Below is the line of code which i got this error. There is no problem with the stream(mem). This stream has 2 pages of pdf.
Stream mem = AzureStorageHelper.DownloadFileFromAzure();//will download the pdf from the storage. It will return as stream. PdfDocument doc1 = new PdfDocument(mem);
Please let me know how to fix the problem.
Regards Mathivanan Ramanathan
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
You need to seek to the beginning of the stream in order for us to read.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 5/4/2016 Posts: 19
|
I had the same problem as I need to retrieve a PDF from a URL. Luckily I found this question and response which resolved my issue. Any chance this seek operation could be added to the PdfDocument(stream) constructor so others don't encounter this?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
Some streams are forward only (such as a NetworkStream), for those stream it is not possible to seek back to the original position. In order to maintain consistent between all streams, we can not seek back on some streams and not on some others. So you will have to do that part in your code.
Thanks!
|
|