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

Free Support Forum - aspose.com

Open the saved pdf in the new browser

I’m using the folliwing code to save the pdf file

private void printReport(string currentIdentityFullName, string cecBodyName, string examName, string approverName, string providerName, string cecPoints,
string approverImageFile, string resultOfExam, string examDate, string score) {
License license = new License();
license.SetLicense(“Aspose.Total.lic”); //the license file is an embedded resource in the project
string approverImage = String.Format(Server.MapPath("~/images/corporates/{0}"), approverImageFile);
if (File.Exists(approverImage))
approverImageFile = approverImage;
approverImageFile = Server.MapPath("~/images/spacer.gif");
// Open the template document.
Document doc = new Document(System.IO.Path.Combine(Server.MapPath("~/Reports/"), “CECCertificateTemplate.doc”));
// Set up the event handler for image fields.
doc.MailMerge.MergeImageField += new MergeImageFieldEventHandler(mailMerge_MergeImageField);
new string[] { “approverImageFile”, “examName”, “currentIdentityFullName”, “cecBodyName”, “providerName”, “cecPoints”, “examDate”, “resultOfExam”, “score”, “ptnLogo”},
new object[] { approverImageFile, examName, currentIdentityFullName, cecBodyName, providerName, cecPoints, examDate, resultOfExam, score, Server.MapPath("~/images/pt_on_the_net.gif") });

doc.Save(currentIdentityFullName + examName, SaveFormat.Pdf, SaveType.OpenInWord, Response);
This works fine. But now the client wants to open the saved pdf in the new browser. Currently the document opens in a new tab for firefox and it opens in the same browser when I tried it in IE 7, 8. What is the easiest work around to overcome the issue?

THanks in advance


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Please see the following forum thread to learn how you can achieve this:

Hope this helps.

Best regards.

THanks for the replay.
But this works when the document is saved in a different page. What I’m doing is I’m saving the document from an event of the same page. So in that kind of scnario., is there any way possible?
Whay I don’t like to do it this way is, if I want to do it this way I have to pass lot of parameters in queary string. And also I’m using mail merge in 3,4 places and it will be really hard to do it.
Youe quick response will be highly appriciated. thanks


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I understand that you would like to generate document on event. But new window should be opened on client side (using JavaScript). You can also try using the following code:

Response.write("window.open(' " + pdfFileName + " ','mywindow','width=400,height=200'));

But in this case, you should save your PDF to file first.

Anyways, I do not think, this question is not actually related to Aspose.Words.

Best regards.