PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Nov 01, 2024 12:59 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Jun 08, 2007 8:34 pm 
Offline

Joined: Fri Jun 08, 2007 8:32 pm
Posts: 2
Instead of opening the PDF directly in the browser, I'd like to prompt the user to save/open it.

Is there a way to do this - without writing the file to the web server's harddisk every time?

Thanks in advance..


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 08, 2007 8:53 pm 
Offline

Joined: Fri Jun 08, 2007 8:32 pm
Posts: 2
answered my own question... if anyone else is interested:
(i apologize, it'd crappy VB)

Code:
        Dim stream As New MemoryStream()
        pdf.Save(stream, False)
        Response.Clear()
        Response.ContentType = "application/pdf"
        Response.AddHeader("Accept-Header", stream.Length.ToString())
        Response.AddHeader("content-length", stream.Length.ToString())
        Dim filename As String
        filename = "test.pdf"
        Response.AddHeader("Content-Disposition", "attachment;filename=" & filename)
        Response.OutputStream.Write(stream.GetBuffer(), 0, stream.Length)
        Response.Flush()
        stream.Close()
        Response.End()


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group