private async void ExportButton_Click(object sender, EventArgs e) { using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = @"PDF|*.pdf"; if (sfd.ShowDialog() != DialogResult.OK) { return; } exportButton.Enabled = false; progressBar1.Value = 0; using (var bs = new FileStream(sfd.FileName, FileMode.Create, FileAccess.ReadWrite)) using (Document document = new Document(PageSize.A4, 36F, 36F, 36F, 36F)) using (PdfWriter writer = PdfWriter.GetInstance(document, bs)) { writer.SetFullCompression(); //Open PDF Document document.Open(); document.Add(HeaderOfCompany("Comidat Personal Takip Raporu")); PdfPTable table = new PdfPTable(2) { WidthPercentage = 100 }; table.AddCell(new PdfPCell(new Phrase { new Chunk("Tarih Aralığı", _baseFontBold), new Chunk($":{dateTimePickerFirst.Value:d} - {dateTimePickerLast.Value:d}", _baseFont) }) { BorderWidth = 0 }); table.AddCell( new PdfPCell(new Phrase { new Chunk("Rapor Tarihi", _baseFontBold), new Chunk($":{DateTime.Now:d}", _baseFont) }) { BorderWidth = 0, HorizontalAlignment = Element.ALIGN_RIGHT }); table.SpacingAfter = 16; document.Add(table); //Get Table Data var data = _database.TBLPositions.AsNoTracking() .Where(p => p.RecordDateTime.Date >= dateTimePickerFirst.Value.Date && p.RecordDateTime.Date <= dateTimePickerLast.Value.Date) //.OrderBy(p => p.TagId) .OrderByDescending(p => p.RecordDateTime) .Join(_database.TBLMaps, p => p.MapId, m => m.Id, (p, m) => new { Position = p, Map = m }) //Join Map .Join(_database.TBLTags, p => p.Position.TagId, t => t.Id, (p, t) => new { p.Position, p.Map, Tag = t }); //Join Tags progressBar1.Maximum = data.Count(); //Write Table table = new PdfPTable(new[] { 3F, 3F, 2F, 1F, 1F, 4F }) { HeaderRows = 1, WidthPercentage = 100 }; table.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; table.AddCell(new PdfPCell(new Phrase("İsim", _baseFontBold)) { HorizontalAlignment = Element.ALIGN_CENTER, GrayFill = 0.85F }); table.AddCell(new PdfPCell(new Phrase("Soyisim", _baseFontBold)) { HorizontalAlignment = Element.ALIGN_CENTER, GrayFill = 0.85F }); table.AddCell(new PdfPCell(new Phrase("Harita", _baseFontBold)) { HorizontalAlignment = Element.ALIGN_CENTER, GrayFill = 0.85F }); table.AddCell(new PdfPCell(new Phrase("X", _baseFontBold)) { HorizontalAlignment = Element.ALIGN_CENTER, GrayFill = 0.85F }); table.AddCell(new PdfPCell(new Phrase("Y", _baseFontBold)) { HorizontalAlignment = Element.ALIGN_CENTER, GrayFill = 0.85F }); table.AddCell(new PdfPCell(new Phrase("Tarih", _baseFontBold)) { HorizontalAlignment = Element.ALIGN_CENTER, GrayFill = 0.85F }); int iterator = 0; await data.ForEachAsync(obj => { table.AddCell(new PdfPCell(new Phrase(obj.Tag.TagFirstName, _baseFont)) { HorizontalAlignment = Element.ALIGN_LEFT }); table.AddCell(new PdfPCell(new Phrase(obj.Tag.TagLastName, _baseFont)) { HorizontalAlignment = Element.ALIGN_LEFT }); table.AddCell(new PdfPCell(new Phrase(obj.Map.MapName, _baseFont))); table.AddCell(new PdfPCell(new Phrase(obj.Position.d_XPosition.ToString(), _baseFont))); table.AddCell(new PdfPCell(new Phrase(obj.Position.d_yPosition.ToString(), _baseFont))); table.AddCell(new PdfPCell(new Phrase(obj.Position.RecordDateTime.ToString("g"), _baseFont))); iterator++; Invoke(progressBar1, p => p.Value = iterator); if (iterator % 10001 != 0) { return; } document.Add(table); table.FlushContent(); }); document.Add(table); table.FlushContent(); document.Close(); writer.Close(); } GC.Collect(GC.MaxGeneration); GC.WaitForFullGCComplete(); MessageBox.Show(@"Dışarı Aktarma Başarılı Birşekilde Tamamlandı.", @"Dışarı Aktarma", MessageBoxButtons.OK); exportButton.Enabled = true; } }
public string PrintVisitNote(gbmodel.patient.Patient p_oPatient, gbmodel.user.User p_oUser) { specialtyNote.SrvPatient oSrvPatient = new specialtyNote.SrvPatient(); List <gbmodel.patient.SpecialtyNote> oList = new List <gbmodel.patient.SpecialtyNote>(); oList = oSrvPatient.SelectSpecialtyNote(p_oPatient); string OpenPdfFilepath = ""; DataSet ds = new DataSet(); ds = GetVisitInfo(p_oPatient.CaseID, p_oPatient.Account.ID); string szfirstname = ""; if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["PatientName"].ToString() != "") { szfirstname = ds.Tables[0].Rows[0]["PatientName"].ToString(); szfirstname = szfirstname.Replace(" ", string.Empty); szfirstname = szfirstname.Replace(".", string.Empty); szfirstname = szfirstname.Replace(",", string.Empty); } } if (ds != null && ds.Tables[1] != null) { string path = getApplicationSetting("PatientInfoSaveFilePath"); string OpenFilepath = getApplicationSetting("PatientInfoOpenFilePath"); path = path + "PatientDeskNotes/"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string newPdfFilename = szfirstname.Trim() + "_Visit_Information_" + DateTime.Now.ToString("MM_dd_yyyyhhmm") + ".pdf"; string pdfPath = path + newPdfFilename; MemoryStream m = new MemoryStream(); iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.A4, 36, 36, 20, 20); float[] wBase = { 4f }; PdfPTable tblBase = new PdfPTable(wBase); tblBase.DefaultCell.Border = Rectangle.NO_BORDER; tblBase.WidthPercentage = 100; PdfWriter writer = PdfWriter.GetInstance(document, m); document.Open(); #region "for printed by" float[] width = { 4f, 4f }; PdfPTable tblprintby = new PdfPTable(width); tblprintby.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; tblprintby.DefaultCell.Border = Rectangle.NO_BORDER; tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT; tblprintby.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_TOP; tblprintby.AddCell(new Phrase("Printed By : " + p_oUser.UserName, iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT; tblprintby.AddCell(new Phrase("Printed on : " + DateTime.Now.ToString("MM/dd/yyyy"), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); tblBase.AddCell(tblprintby); #endregion tblBase.AddCell(" "); #region "for patient information" float[] wdh = { 4f }; PdfPTable tblheading = new PdfPTable(wdh); tblheading.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; tblheading.DefaultCell.Border = Rectangle.NO_BORDER; tblheading.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER; tblheading.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE; tblBase.AddCell(tblheading); #endregion #region for Personal Information float[] w11 = { 3f, 3f, 3f, 3f }; PdfPTable table = new PdfPTable(w11); table.WidthPercentage = 100; table.DefaultCell.BorderColor = Color.BLACK; PdfPCell cell1 = new PdfPCell(new Phrase("Personal Information", iTextSharp.text.FontFactory.GetFont("Arial", 11, iTextSharp.text.Color.BLACK))); cell1.Colspan = 4; cell1.BackgroundColor = Color.LIGHT_GRAY; cell1.BorderColor = Color.BLACK; table.AddCell(cell1); table.AddCell(new Phrase("Patient Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["PatientName"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["PatientName"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Case #", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["CaseNo"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["CaseNo"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Insurance Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } PdfPCell cell2 = new PdfPCell(new Phrase("")); cell2.Colspan = 2; cell2.BorderColor = Color.BLACK; table.AddCell(cell2); tblBase.AddCell(table); #endregion document.Add(tblBase); DataTable dt = ds.Tables[1]; string[] columns = { "SpecialtyID" }; DataTable dataTable = GetDistinctRecords(dt, columns); DataSet dsFiltered = new DataSet(); dsFiltered.Tables.Add(dataTable); #region for Visit Information float[] wd1 = { 3f, 1.5f, 1.5f, 1.5f, 1.5f, 6f, 1.5f, 3f }; PdfPTable tblVisit = new PdfPTable(wd1); tblVisit.WidthPercentage = 100; tblVisit.DefaultCell.BorderColor = Color.BLACK; tblVisit = GetTableHeader(wd1); float[] wdBlank = { 4f }; PdfPTable tblBlank = new PdfPTable(wdBlank); tblBlank.WidthPercentage = 100; tblBlank.DefaultCell.Border = Rectangle.NO_BORDER; tblBlank.AddCell(""); tblBlank.DefaultCell.Border = Rectangle.NO_BORDER; float[] wdNotes = { .5f, 3.5f }; PdfPTable tblNotes = new PdfPTable(wdNotes); tblNotes.WidthPercentage = 100; string text = ""; for (int i = 0; i < dsFiltered.Tables[0].Rows.Count; i++) { DataRow[] result = ds.Tables[1].Select("SpecialtyID = '" + dsFiltered.Tables[0].Rows[i]["SpecialtyID"].ToString() + "'"); for (int j = 0; j < result.Length; j++) { float fPosition = writer.GetVerticalPosition(true); if (result[j]["DctorName"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["DctorName"].ToString()), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["DT_EVENT_DATE"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["DT_EVENT_DATE"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["Specialty"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["Specialty"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["STATUS"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["STATUS"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["VisitType"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["VisitType"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["ProcedureCode"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["ProcedureCode"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["BillStatus"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["BillStatus"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["Provider"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["Provider"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } } for (int k = 0; k < oList.Count; k++) { if (dsFiltered.Tables[0].Rows[i]["SpecialtyID"].ToString() == oList[k].Speciality.ID.ToString()) { text = oList[k].Text.ToString(); tblNotes.FlushContent(); tblNotes.AddCell(new Phrase("NOTE:", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); tblNotes.AddCell(new Phrase(text, iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); document.Add(tblBlank); if (text != "") { document.Add(tblNotes); } break; } } document.Add(tblVisit); document.Add(tblBlank); document.Add(tblBlank); tblVisit.DeleteBodyRows(); tblVisit = GetTableHeader(wd1); } #endregion document.Close(); System.IO.File.WriteAllBytes(pdfPath, m.GetBuffer()); OpenPdfFilepath = OpenFilepath + "PatientDeskNotes/" + newPdfFilename; } return(OpenPdfFilepath); }
protected void generateQuestionsPDF() { DataTable WorkTable = getDataTableForQuestions(QuestionsType, CourseCode, IncludeCA); int RepetitionsCount = getRepetitionsCount(WorkTable); string strQtype = string.Empty; switch (QuestionsType) { case 1: strQtype = "Very short/MCQ Qestions [1 Mark]"; break; case 2: strQtype = "Short Questions [2-2.5 Marks]"; break; case 5: strQtype = "Short Questions [5 Marks]"; break; case 10: strQtype = "Long Questions [10 Marks]"; break; case 15: strQtype = "Long Questions [15 Marks]"; break; default: break; } var ExtractedQuestionsPDF = new Document(PageSize.A4, 30, 20, 50, 50); string SavePath = Server.MapPath("PDFs"); PdfWriter.GetInstance(ExtractedQuestionsPDF, new FileStream(SavePath + "/Questions.pdf", FileMode.Create)); ExtractedQuestionsPDF.Open(); //addding header Paragraph header = new Paragraph(strQtype, TopHeader); header.Alignment = Element.ALIGN_CENTER; ExtractedQuestionsPDF.Add(header); //END//addding header if (CourseCode != "N") { Paragraph CCode = new Paragraph(CourseCode, TopHeader); CCode.Alignment = Element.ALIGN_CENTER; ExtractedQuestionsPDF.Add(CCode); } ///data set stats DataView view = new DataView(WorkTable); int qCount = view.ToTable(true, new string[] { "Statement" }).Rows.Count; //int qCount = WorkTable.Rows.Count;///200 questions found from 33 papers DataView dv = new DataView(WorkTable); int pCount = dv.ToTable(true, "PNR").Rows.Count; string QuestionsGrammarCorrector = qCount > 1 ? "questions" : "question"; string PapersGrammarCorrector = pCount > 1 ? "papers" : "paper"; //int repcount = getRepetitionsCount(WorkTable); string RepsJoiner = string.Empty; if (RepetitionsCount > 1) { RepsJoiner = " with " + RepetitionsCount.ToString() + " repeated questions"; } else if (RepetitionsCount == 1) { RepsJoiner = " with " + RepetitionsCount.ToString() + " repeated question"; } Paragraph DataSetstats = new Paragraph("Showing " + qCount + " " + QuestionsGrammarCorrector + " from " + pCount + " " + PapersGrammarCorrector + RepsJoiner, Topsmall); DataSetstats.Alignment = Element.ALIGN_CENTER; ExtractedQuestionsPDF.Add(DataSetstats); //END/data set stats //// adding "Questions" header Paragraph QuestionsHeader = new Paragraph("Questions", TopHeader17); QuestionsHeader.Alignment = Element.ALIGN_CENTER; ExtractedQuestionsPDF.Add(new Paragraph("\n")); ExtractedQuestionsPDF.Add(QuestionsHeader); ExtractedQuestionsPDF.Add(new Paragraph("\n", small)); //ExtractedQuestionsPDF.Add(new Paragraph("\n"));//spacemaker //END// adding "Questions" header /* * ////CA indicator * PdfPCell CAindicator = new PdfPCell(new Phrase("CA", Topsmall)); * CAindicator.HorizontalAlignment = Element.ALIGN_CENTER; * //END//CA indicator */ ////Real-time Question Table PdfPTable QuestionTable = new PdfPTable(4);//Numbering &Statement + Weightage + CA/MTE/ETE + RepetedSTAR QuestionTable.WidthPercentage = 100; QuestionTable.SetWidths(new float[] { .79f, .06f, .12f, .03f }); PdfPCell cell_QuestionHolder = new PdfPCell(); PDFtester PDFfuncs = new PDFtester();//getting custom PDF functions class int QuestionNumber = 1; for (int c = 0; c < qCount; c++)//rendering questions from Datatable to PDF///CAN BE OPTIMIZED MORE { DataRow question = WorkTable.Rows[c]; QuestionTable.FlushContent(); ////Adding question statement if (question["Option1"].ToString() == "")//is not MCQ { cell_QuestionHolder = PDFfuncs.convertTableToCell(renderNonMCQQuestion(question, QuestionNumber++)); } else { cell_QuestionHolder = PDFfuncs.convertTableToCell(PDFfuncs.renderMCQQuestion(question, PDFfuncs.detectQuestionPattern(question), QuestionNumber++)); } //QuestionTable.AddCell(cell_QuestionHolder);////PICKUP//// //END//Adding question statement ////Adding Weightage //QuestionTable.AddCell(PDFfuncs.removeBorders(new PdfPCell(new Phrase("[" + PDFfuncs.formatMarks(question["Weightage"].ToString()) + "]", questionfont))));////PICKUP//// //END//Adding Weightage ////Adding QuestionPaper type Anchor PaperLinker = new Anchor(new Phrase(getQuestionSourcePaper(question["PNR"].ToString()), boldquestionfontLINK)); //PaperLinker.Reference = "http://localhost:50876/ViewQuestionPaper.aspx?p=" + new QueryStringEncryption().encryptQueryString(question["PNR"].ToString());//for TEST environment only PaperLinker.Reference = "http://blackchair.manhardeep.com/ViewQuestionPaper.aspx?p=" + new QueryStringEncryption().encryptQueryString(question["PNR"].ToString());//for PRODUCTION environment only //QuestionTable.AddCell(PDFfuncs.removeBorders(new PdfPCell(PaperLinker)));////PICKUP//// //END//Adding QuestionPaper type ////Adding Repetitions thingy if (isRepeatedQuestion(question["QuestionID"].ToString())) { if (!RepeatedQuestionOnceEntered.Contains(question["Statement"].ToString()))//Add to PDF only if not in pdf already { RepeatedQuestionOnceEntered.Add(question["Statement"].ToString()); iTextSharp.text.Image repIcon = iTextSharp.text.Image.GetInstance(Server.MapPath("Icons") + "/repIcon.png"); Chunk chnk_RepeatedIcon = new Chunk(repIcon, 0, 0, false); Anchor repImage = new Anchor(chnk_RepeatedIcon); QueryStringEncryption Ecryptor = new QueryStringEncryption(); //repImage.Reference = "http://localhost:50876/RepetitionsShower.aspx?QuestionID=" + Ecryptor.encryptQueryString(question["QuestionID"].ToString()) + "&sl=" + giveRepetitionsHyperlinkURL(question["Statement"].ToString()) + "&p=" + Ecryptor.encryptQueryString(question["PNR"].ToString()); repImage.Reference = "http://blackchair.manhardeep.com/RepetitionsShower.aspx?QuestionID=" + Ecryptor.encryptQueryString(question["QuestionID"].ToString()) + "&sl=" + giveRepetitionsHyperlinkURL(question["Statement"].ToString()) + "&p=" + Ecryptor.encryptQueryString(question["PNR"].ToString()); PdfPCell cell_ImgREP = new PdfPCell(repImage); cell_ImgREP.VerticalAlignment = Element.ALIGN_BOTTOM; repIcon.ScaleAbsolute(30f, 30f); QuestionTable.AddCell(cell_QuestionHolder); ////PICKUP//// QuestionTable.AddCell(PDFfuncs.removeBorders(new PdfPCell(new Phrase("[" + PDFfuncs.formatMarks(question["Weightage"].ToString()) + "]", questionfont)))); ////PICKUP//// QuestionTable.AddCell(PDFfuncs.removeBorders(new PdfPCell(PaperLinker))); ////PICKUP//// QuestionTable.AddCell(PDFfuncs.removeBorders(new PdfPCell(cell_ImgREP))); ExtractedQuestionsPDF.Add(QuestionTable); } else { QuestionNumber--; qCount++; System.Diagnostics.Debug.WriteLine("in already in reps"); //QuestionTable.FlushContent(); } } else//if not repeated question { QuestionTable.AddCell(cell_QuestionHolder);////PICKUP//// QuestionTable.AddCell(PDFfuncs.removeBorders(new PdfPCell(new Phrase("[" + PDFfuncs.formatMarks(question["Weightage"].ToString()) + "]", questionfont)))); ////PICKUP//// QuestionTable.AddCell(PDFfuncs.removeBorders(new PdfPCell(PaperLinker))); ////PICKUP//// QuestionTable.AddCell(PDFfuncs.removeBorders(new PdfPCell())); ExtractedQuestionsPDF.Add(QuestionTable); } //END//Adding Repetitions thingy ExtractedQuestionsPDF.Add(new Paragraph("\n")); } ExtractedQuestionsPDF.Close(); PDFfuncs.AddPageNumber(Server.MapPath("PDFs") + "/Questions.pdf"); }