Welcome Guest Search | Active Topics | Sign In | Register

Error in downloading the pdf using Stream. Options
Mathivanan
Posted: Sunday, March 20, 2016 7:53:47 AM
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
eo_support
Posted: Sunday, March 20, 2016 12:54:37 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Hi,

You need to seek to the beginning of the stream in order for us to read.

Thanks!
Gabe
Posted: Wednesday, June 15, 2016 5:31:35 PM
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?
eo_support
Posted: Wednesday, June 15, 2016 6:53:44 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.