$(document).off("click", "#btnPreviewAndDownload").on("click", "#btnPreviewAndDownload", function (e) {
var QuestionPaperID = 1;
var SubjectCode = '@Model.Model.SubjectPapperCode';
window.location = "@Url.Action("PreviewAndDownloadQuestionPaper", "TeamCreation")?QuestionPaperID=" + QuestionPaperID + "&SubjectPapperCode=" + SubjectCode;
});
private FileResult CreateQuestionPaperPDF(List<CustomMainQuestionDTO> questionDTOList, byte[] byteDoc, MemoryStream memStream)
{
Document doc = new Document(iTextSharp.text.PageSize.A4, 70, 40, 70, 40);
PdfWriter writer = PdfWriter.GetInstance(doc, memStream);
Font fontH1 = new Font(Font.FontFamily.HELVETICA, 11, Font.BOLD);
doc.Open();
doc.NewPage();
Paragraph Heading = new Paragraph(questionDTOList[0].SubjectName, fontH4);
Heading.Alignment = Element.ALIGN_CENTER;
doc.Add(Heading);
foreach (var questionDTO in questionDTOList)
{
doc.Add(Chunk.NEWLINE);
if (String.IsNullOrEmpty(questionDTO.QuestionParentQuestionMappingID.ToString()))
{
MainQuestion(questionDTO, fontH2, doc, fontH1Bold);
}
else
{
SubQuestion(questionDTO, fontH2, fontH1, doc);
}
}
doc.Close();
byteDoc = memStream.GetBuffer();
string fileName = "QuestionPaper - " + questionDTOList[0].SubjectName + ".pdf";
return File(byteDoc, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
}
i have created and aligned the question paper format using Itextsharp and downloaded it. it is downloading in window but unable to open in new tab? How i can open the generated PDF in new tab?