PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Apr 28, 2024 11:45 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: web PDF save-as name
PostPosted: Tue Aug 18, 2009 10:32 pm 
Offline

Joined: Mon Aug 17, 2009 8:12 pm
Posts: 2
I have a C# .net web application that creates PDF files and serves them up to the user in a browser (works great). What I would like is when the user clicks save-as from the PDF viewer, It's alredy got a file-name all set for them. Right now, it seems to default to the .aspx page name.

Using the latest PDFsharp dll (1.30 I think - just downloaded a few days ago)

-Paul C.


Top
 Profile  
Reply with quote  
 Post subject: Re: web PDF save-as name
PostPosted: Wed Aug 19, 2009 9:56 am 
Offline
Supporter

Joined: Fri May 15, 2009 3:28 pm
Posts: 96
when outputting your PDF file, you can set:
Code:
Response.AddHeader("Content-Disposition", "attachment;filename="+_filename+".pdf");

where the filename var is the string you wish to save the PDF as. Please note that changing "attachment" to inline will try to open the PDF in the browser, rather than giving a Save As prompt, but I have experienced problems with this, so I stick to using attachment (as it will always use the filename you set it to, whereas inline seems to behave differently from browser to browser)

hope this helps!


Top
 Profile  
Reply with quote  
 Post subject: Re: web PDF save-as name
PostPosted: Wed Aug 19, 2009 3:08 pm 
Offline

Joined: Mon Aug 17, 2009 8:12 pm
Posts: 2
Great. Thanks. That did the trick!

Is there any way to remove the extra [1] that seems to get in the filename when saved? I've seen this before making other formats. filename.pdf becomes filename[1].pdf when saving.


Top
 Profile  
Reply with quote  
 Post subject: Re: web PDF save-as name
PostPosted: Fri Aug 28, 2009 3:00 pm 
Offline
Supporter

Joined: Fri May 15, 2009 3:28 pm
Posts: 96
Hi,

I have not come accross a way to get rid of this - i think its something to do with how the browser is caching files - but thats a guess!

Mike


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 398 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