Right now the generated pdf is saving on my computer and i need to preview it so that i can either choose to download or to print it. I have a feeling i need to save the generated pdf in a memory stream and then use that as a path to open it in a new window, but i don't know how to do that.
If there is a different way of doing it I'm also open to that.
This is the code i have that generates a pdf and downloads it on a button click event.
protected void btn_process_invoice_Click(object sender, EventArgs e)
{
int id = Int32.TryParse(txt_update_invoice_id.Text, out id) ? id : 0;
int update_invoice_id = int.TryParse(txt_update_invoice_id.Text, out update_invoice_id) ? update_invoice_id : 0;
int linked_comp_id = int.TryParse(DD_update_comp_name.SelectedValue, out linked_comp_id) ? linked_comp_id : 0;
int client_comp_id = int.TryParse(DD_update_client_name.SelectedValue, out client_comp_id) ? client_comp_id : 0;
DateTime inv_date = DateTime.TryParse(txt_update_invoice_date.Text, out inv_date) ? inv_date : DateTime.MinValue;
DateTime due_date = DateTime.TryParse(txt_update_due_dates.Text, out due_date) ? due_date : DateTime.MinValue;
int inserted_id = 0;
db_invoice.save(id, linked_comp_id, client_comp_id, txt_update_invoice_num.Text, inv_date, due_date, txt_ref.Text, txt_update_pastel_ref.Text, 2, out inserted_id);
Session["id"] = id.ToString();
Session["invoice_num"] = txt_update_invoice_num.Text;
//ScriptManager.RegisterStartupScript(Page, Page.GetType(), "newWindow", "$window.open('../view_invoice.aspx');", true);
Response.Redirect("~/view_invoice.aspx");
//Response.Redirect("~/invoice.aspx");
}