Saturday, 31 August 2013

open pdf toprint in new tab using javascript in asp.net c#

open pdf toprint in new tab using javascript in asp.net c#

hiexperts,
i need your help. i have a web application and i am creating a pdf using
itext sharp and trying to print it silently.
after creating the pdf i am tring to print it using the code
MemoryStream ms = new MemoryStream();
string baseUrl = Request.Url.GetLeftPart(UriPartial.Authority);
var urlPdf = Server.MapPath("~/MERGPdf/Merge_doc.pdf");
PdfReader ps = new PdfReader(urlPdf);
/*inserts js into pdf*/
PdfStamper pdf = new PdfStamper(ps, ms);
pdf.JavaScript = "this.print({bUI: false, bSilent: true, bShrinkToFit:
true});";
but my issue is, the pdf is opening in same window and the user has to
click back button to go to page.. how can avoid it..
regards,
Sivajith S.

No comments:

Post a Comment