1
Reply

How to Disable or Prevent a .Pdffile from being printed or d

Paul Rajs

Paul Rajs

Sep 5 2017 8:10 AM
165
hi Developers ,
i want to disable or prevent a .Pdf file on browser .
in my project i am opening a .Pdf from database to new tab . now i want to Disable Printable or Download from the End user. because all attachments are govt property and valuables.
this is my code for open a .Pdf file on a new tab .
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = Connection.DBConn();
string str = "SELECT KeyFactsFileName FROM tbl_question where id='" + sno + "' and status='A'";
SqlDataAdapter sda = new SqlDataAdapter(str, con);
DataSet ds = new DataSet();
sda.Fill(ds);
string path = ds.Tables[0].Rows[0]["KeyFactsFileName"].ToString();
string urlName = Request.Url.AbsoluteUri;
urlName = urlName.Remove(urlName.LastIndexOf("/"));
string url = string.Format("{0}/Files/{1}", urlName, path);
string script = "<script type='text/javascript'>window.open('" + url + "')</script>";
this.ClientScript.RegisterStartupScript(this.GetType(), "script", script);
}
how can i done this task , could anyone know please suggest me to how can i done this task
thanking with
Paul.S

Answers (1)