0

I am using the code given in this link to watermark my documents.

Here the author has used IHttpHandler to watermark document whenever a user clicks on a pdf document.

Whenever I click on a document link in the document library the document gets opened inside the browser with the watermark and stuff, instead of showing the default save or cancel dialog box. I don't want the document to get displayed inside the browser and then save it from there. I want to have the default save dialog box that usually appears when you click on document link. How can I do that?

1 Answer 1

1

Try adding:

context.Response.AddHeader("content-disposition", "attachment;filename=" + file.Name);
2
  • Do I have to add this in feature event receiver or in the class where I have implemented IHttpHandler? Sorry for asking such a naive question. I am pretty new to sharepoint
    – A Beginner
    Apr 27, 2015 at 12:54
  • It should be part of ProcessRequest in PDFWatermarkHttpHandler when setting context.Response.ContentType Apr 27, 2015 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.