We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Protected pdf


I have a problem about disable the "Save as"(Ctrl+S) and "Print"(Ctrl+P) when right clicked on pdf web page.(for protect it not share with anyone,means only show it for information).

I have wrote a code as below.


public HttpResponse GetPdf(int id)


MyContext.File I = null;

if (id > 0)

I = (from p in File where p.ID == id select p).SingleOrDefault();

HttpResponseMessage R = null;

var context = HttpContext.Current;

if (I != null)


context.Response.Buffer = true;

context.Response.Charset = "";


context.Response.ContentType = "application/pdf";

context.Response.AppendHeader("Content-Disposition", "inline; filename=" + I.NAME+ ";");






R = Request.CreateResponse(HttpStatusCode.BadRequest);

return context.Response;


If your tool can provide, could you please help us?



Hello There,

Thanks for your inquiry.

You can convert PDF file into images with Aspose.Pdf for .NET and display them as per your requirement, through HTML and jQuery in your website. However in order to prevent files/images, so that no user can download/save or print them, there can be two effective ways to achieve that.

1- You can implement keydown and mousedown events using JavaScript and return false like following, so that user will not be able to save image.

$(’{your image}’).mousedown(function (e) {
if(e.button == 2) { // right click
return false; // do nothing!

2- You can use background-image property to show images, this way user will also not be able to download or see the save as option.

3- You can implement Data URI scheme to prevent users from saving images easily.

Please check “Convert PDF Pages” article in our API documentation, to convert PDF into Image. Furthermore you can also consider using GroupDocs.Viewer for .NET API, provided by our sister company GroupDocs. In case of any further assistance, please feel free to contact us.

Best Regards,