I want to generate a PDF file on server side, and then in response want to send that file (buffer,fileName- whatever may work) and show a print dialog to ask user to print the generated PDF file.
I tried something like below. But it does not trigger window.print() dialog.
public static void ForcedPrint(HttpResponse response, byte[] buffer, string fileName, string fileExtension) {
response.Clear();
response.Buffer=true;
response.Write("<script>window.print();</script>");
response.Charset="";
response.Cache.SetCacheability(HttpCacheability.NoCache);
response.ContentType="application/pdf";
response.BinaryWrite(buffer);
response.Flush();
response.End();
}
Can someone please help me with this? The feature i am looking for is that i should be able to create PDF file on server, and in response user should get a dialog to print the generated file.
Thanks in advance.