Download pdf programatically...

Posted by Perplexed on Stack Overflow See other posts from Stack Overflow or by Perplexed
Published on 2010-05-26T14:26:03Z Indexed on 2010/05/26 14:31 UTC
Read the original article Hit count: 203

Filed under:
|
|
|
|

Hi,

How can I download a pdf and store to disk using vb.net or c#?

The url (of the pdf) has some rediection going on before the final pdf is reached.

I tried the below but the pdf seems corrupted when I attempt to open locally,

Dim PdfFile As FileStream = File.OpenWrite(saveTo)
Dim PdfStream As MemoryStream = GetFileStream(pdfURL)
PdfStream.WriteTo(PdfFile)
PdfStream.Flush()
PdfStream.Close()
PdfFile.Flush()
PdfFile.Close()

many thanks,

KS

© Stack Overflow or respective owner

Related posts about c#

Related posts about vb.net