public void PrintCloseCustomerReciept(CustomerMgntRef.Customer customer) { Distributor dis = new Distributor(); string disName = dis.AgencyName; string disCode = dis.code.ToString(); string addr = dis.Address + ", " + dis.City + "\n" + "District: " + dis.District + ", State: " + dis.State; string phon = dis.ContectNo; string gstin = dis.GSTIN; try { #region Page #region Section-1 iTextSharp.text.Font fontH1 = new iTextSharp.text.Font(BaseFont.CreateFont( BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED), 8, iTextSharp.text.Font.NORMAL); var boldFont = FontFactory.GetFont(FontFactory.TIMES_BOLD, 8); PdfPTable pdfTable1 = new PdfPTable(1); //Here 1 is Used For Count of Column PdfPTable pdfTable2 = new PdfPTable(2); PdfPTable pdfTable3 = new PdfPTable(2); pdfTable1.WidthPercentage = 100; pdfTable1.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfTable1.DefaultCell.VerticalAlignment = Element.ALIGN_CENTER; pdfTable1.DefaultCell.BorderWidth = 0; pdfTable2.WidthPercentage = 100; pdfTable2.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfTable2.DefaultCell.VerticalAlignment = Element.ALIGN_CENTER; pdfTable2.DefaultCell.BorderWidth = 0; pdfTable3.WidthPercentage = 100; pdfTable3.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; pdfTable3.DefaultCell.VerticalAlignment = Element.ALIGN_CENTER; pdfTable3.DefaultCell.BorderWidth = 0.5f; int[] firstTablecellwidth = { 10, 90 }; pdfTable2.SetWidths(firstTablecellwidth); string imageURL = @"./../Debug/Bill/logo.png"; iTextSharp.text.Image myImage = iTextSharp.text.Image.GetInstance(imageURL); myImage.ScaleToFit(38f, 38f); myImage.SpacingBefore = 5f; myImage.SpacingAfter = 10f; PdfPCell cellWithRowspan = new PdfPCell(myImage); cellWithRowspan.BorderWidth = 0.0f; cellWithRowspan.Rowspan = 3; cellWithRowspan.HorizontalAlignment = Element.ALIGN_RIGHT; pdfTable2.AddCell(cellWithRowspan); Chunk c1 = new Chunk(disName + " (" + disCode + ") ", FontFactory.GetFont("Times New Roman")); c1.Font.Color = new iTextSharp.text.BaseColor(255, 0, 0); c1.Font.SetStyle(0); c1.Font.Size = 10; Phrase p1 = new Phrase(); p1.Add(c1); pdfTable2.AddCell(p1); Chunk c2 = new Chunk(addr, FontFactory.GetFont("Times New Roman")); c2.Font.Color = new iTextSharp.text.BaseColor(0, 0, 0); c2.Font.SetStyle(0); //0 For Normal Font c2.Font.Size = 8; Phrase p2 = new Phrase(); p2.Add(c2); pdfTable2.AddCell(p2); //pdfTable2.AddCell(p2); Chunk c3 = new Chunk("Phone No : " + phon + " | GSTIN : " + gstin + "\n\n", FontFactory.GetFont("Times New Roman")); c3.Font.Color = new iTextSharp.text.BaseColor(0, 0, 0); c3.Font.SetStyle(0); c3.Font.Size = 8; Phrase p3 = new Phrase(); p3.Add(c3); pdfTable2.AddCell(p3); //pdfTable2.AddCell(p3); #endregion #region section Table pdfTable1.AddCell(new Phrase("Close Connetion Reciept")); pdfTable3.AddCell(new Phrase("")); pdfTable3.AddCell(new Phrase("Customer Id: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.CustomerId + "", fontH1)); pdfTable3.AddCell(new Phrase("Customer Name: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.CustomerName + "", fontH1)); pdfTable3.AddCell(new Phrase("Gender: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.Gender + "", fontH1)); pdfTable3.AddCell(new Phrase("Customer Type: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.CustomerType + "", fontH1)); pdfTable3.AddCell(new Phrase("Adhar Number: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.AadharNo + "", fontH1)); pdfTable3.AddCell(new Phrase("Ration Card Number: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.RashanCardNo + "", fontH1)); pdfTable3.AddCell(new Phrase("Address: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.Address + "", fontH1)); pdfTable3.AddCell(new Phrase("City/Village: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.City + "", fontH1)); pdfTable3.AddCell(new Phrase("Taluka: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.Taluka + "", fontH1)); pdfTable3.AddCell(new Phrase("District: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.District + "", fontH1)); pdfTable3.AddCell(new Phrase("State: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.State + "", fontH1)); pdfTable3.AddCell(new Phrase("PIN No.: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.PinNo + "", fontH1)); pdfTable3.AddCell(new Phrase("Contect No.: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.ContactNo + "", fontH1)); pdfTable3.AddCell(new Phrase("Email: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.Email + "", fontH1)); pdfTable3.AddCell(new Phrase("Bank IFSC: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.BankIFSC + "", fontH1)); pdfTable3.AddCell(new Phrase("Bank Account No.: ", fontH1)); pdfTable3.AddCell(new Phrase(customer.BankAccountNo + "", fontH1)); var cell = new PdfPCell(new Phrase("\n'Your Safety is our Priority' In case of Emergency Call 1906 For any complaints / Queries call: 1800 - 233 - 3555(Toll Free)", fontH1)); cell.Colspan = 2; pdfTable3.AddCell(cell); var cell1 = new PdfPCell(new Phrase("\n\n" + dis.AgencyName + "\n" + "\t\t" + "Signature & Sign of Distributor", fontH1)); var cell2 = new PdfPCell(new Phrase("\n\n\n" + "\t\t" + "Signature of Customer", fontH1)); cell1.HorizontalAlignment = Element.ALIGN_CENTER; cell2.HorizontalAlignment = Element.ALIGN_CENTER; pdfTable3.AddCell(cell1); pdfTable3.AddCell(cell2); #endregion #endregion SaveFileDialog sfd = new SaveFileDialog(); sfd.InitialDirectory = @"C:\"; sfd.RestoreDirectory = true; sfd.FileName = "CloseCust"; sfd.DefaultExt = "pdf"; sfd.Filter = "Pdf Files|*.pdf"; if (sfd.ShowDialog() == DialogResult.OK) { string path = sfd.FileName; using (FileStream stream = new FileStream(path, FileMode.Create)) { Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); PdfWriter.GetInstance(pdfDoc, stream); pdfDoc.Open(); #region PAGE-1 pdfDoc.Add(pdfTable2); pdfDoc.Add(pdfTable1); pdfDoc.Add(pdfTable3); pdfDoc.NewPage(); #endregion pdfDoc.Close(); stream.Close(); } MessageBox.Show("Close Connetion Reciept is generated successfully!!!"); } } catch (Exception ex) { throw; } }
private static void PrintReceipt(string cname, int cmnum, List <StockMgntRef.Stove> stoves, DataGridView dataGridView3, List <TransactionMgnt.GSTRates> gstrates) { Distributor dis = new Distributor(); string disName = dis.AgencyName; string disCode = dis.code.ToString(); string addr = dis.Address + ", \n" + dis.City + " District: " + dis.District + ", State: " + dis.State; string phon = dis.ContectNo; string gstin = dis.GSTIN; int cashmemo = cmnum; int custNo = 15; string custName = cname; string date = DateTime.Now.ToShortDateString(); string custoAddr = "-"; try { #region Page #region Section-1 iTextSharp.text.Font fontH1 = new iTextSharp.text.Font(BaseFont.CreateFont( BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED), 8, iTextSharp.text.Font.NORMAL); var boldFont = FontFactory.GetFont(FontFactory.TIMES_BOLD, 8); PdfPTable pdfTable1 = new PdfPTable(1);//Here 1 is Used For Count of Column PdfPTable pdfTable2 = new PdfPTable(4); PdfPTable pdfTable3 = new PdfPTable(4); pdfTable1.WidthPercentage = 100; pdfTable1.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfTable1.DefaultCell.VerticalAlignment = Element.ALIGN_CENTER; pdfTable1.DefaultCell.BorderWidth = 0; pdfTable2.WidthPercentage = 100; pdfTable2.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfTable2.DefaultCell.VerticalAlignment = Element.ALIGN_CENTER; pdfTable2.DefaultCell.BorderWidth = 0; pdfTable3.WidthPercentage = 100; pdfTable3.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; pdfTable3.DefaultCell.VerticalAlignment = Element.ALIGN_CENTER; pdfTable3.DefaultCell.BorderWidth = 0.5f; int[] firstTablecellwidth = { 7, 43, 7, 43 }; pdfTable2.SetWidths(firstTablecellwidth); string imageURL = @"./../Debug/Bill/logo.png"; iTextSharp.text.Image myImage = iTextSharp.text.Image.GetInstance(imageURL); myImage.ScaleToFit(38f, 38f); myImage.SpacingBefore = 5f; myImage.SpacingAfter = 10f; PdfPCell cellWithRowspan = new PdfPCell(myImage); cellWithRowspan.BorderWidth = 0.0f; cellWithRowspan.Rowspan = 3; cellWithRowspan.HorizontalAlignment = Element.ALIGN_RIGHT; pdfTable2.AddCell(cellWithRowspan); Chunk c1 = new Chunk(disName + " (" + disCode + ") ", FontFactory.GetFont("Times New Roman")); c1.Font.Color = new iTextSharp.text.BaseColor(255, 0, 0); c1.Font.SetStyle(0); c1.Font.Size = 10; Phrase p1 = new Phrase(); p1.Add(c1); pdfTable2.AddCell(p1); pdfTable2.AddCell(cellWithRowspan); Chunk c11 = new Chunk(disName + " (" + disCode + ") ", FontFactory.GetFont("Times New Roman")); c11.Font.Color = new iTextSharp.text.BaseColor(0, 0, 255); c11.Font.SetStyle(0); c11.Font.Size = 10; Phrase p11 = new Phrase(); p11.Add(c11); pdfTable2.AddCell(p11); Chunk c2 = new Chunk(addr, FontFactory.GetFont("Times New Roman")); c2.Font.Color = new iTextSharp.text.BaseColor(0, 0, 0); c2.Font.SetStyle(0);//0 For Normal Font c2.Font.Size = 8; Phrase p2 = new Phrase(); p2.Add(c2); pdfTable2.AddCell(p2); pdfTable2.AddCell(p2); Chunk c3 = new Chunk("Phone No : " + phon + " | GSTIN : " + gstin + "\n\n", FontFactory.GetFont("Times New Roman")); c3.Font.Color = new iTextSharp.text.BaseColor(0, 0, 0); c3.Font.SetStyle(0); c3.Font.Size = 8; Phrase p3 = new Phrase(); p3.Add(c3); pdfTable2.AddCell(p3); pdfTable2.AddCell(p3); #endregion #region section Table pdfTable3.AddCell(new Phrase("Cashmemo No.: ", fontH1)); pdfTable3.AddCell(new Phrase(cashmemo + "", fontH1)); pdfTable3.AddCell(new Phrase("Cashmemo No.: ", fontH1)); pdfTable3.AddCell(new Phrase(cashmemo + "", fontH1)); pdfTable3.AddCell(new Phrase("Customer ID: ", fontH1)); pdfTable3.AddCell(new Phrase(custNo + "", fontH1)); pdfTable3.AddCell(new Phrase("Customer ID: ", fontH1)); pdfTable3.AddCell(new Phrase(custNo + "", fontH1)); pdfTable3.AddCell(new Phrase("Customer Name: ", fontH1)); pdfTable3.AddCell(new Phrase(custName + "", fontH1)); pdfTable3.AddCell(new Phrase("Customer Name: ", fontH1)); pdfTable3.AddCell(new Phrase(custName + "", fontH1)); pdfTable3.AddCell(new Phrase("Transaction Date: ", fontH1)); pdfTable3.AddCell(new Phrase(date + "", fontH1)); pdfTable3.AddCell(new Phrase("Transaction Date: ", fontH1)); pdfTable3.AddCell(new Phrase(date + "", fontH1)); pdfTable3.AddCell(new Phrase("Address: ", fontH1)); pdfTable3.AddCell(new Phrase(custoAddr + "", fontH1)); pdfTable3.AddCell(new Phrase("Address: ", fontH1)); pdfTable3.AddCell(new Phrase(custoAddr + "", fontH1)); double totalAmt = 0; PdfPTable pdfTable = new PdfPTable(4); pdfTable.DefaultCell.Padding = 3; pdfTable.WidthPercentage = 100; pdfTable.HorizontalAlignment = Element.ALIGN_LEFT; int[] cellWidth = { 40, 10, 25, 25 }; pdfTable.SetWidths(cellWidth); foreach (DataGridViewColumn column in dataGridView3.Columns) { if (column.HeaderText.Equals("Quentity")) { pdfTable.AddCell(new Phrase("Qty", boldFont)); } else { pdfTable.AddCell(new Phrase(column.HeaderText, boldFont)); } } foreach (DataGridViewRow row in dataGridView3.Rows) { if (row.Cells[0].Value != null) { pdfTable.AddCell(new Phrase(row.Cells[0].Value.ToString(), fontH1)); pdfTable.AddCell(new Phrase(row.Cells[1].Value.ToString(), fontH1)); pdfTable.AddCell(new Phrase(row.Cells[2].Value.ToString(), fontH1)); double temp = double.Parse(row.Cells[1].Value.ToString()) * double.Parse(row.Cells[2].Value.ToString()); totalAmt += temp; pdfTable.AddCell(new Phrase(temp + "", fontH1)); } } PdfPCell tmwot = new PdfPCell(new Phrase("Total Amount(without taxes) :", fontH1)); tmwot.Colspan = 3; pdfTable.AddCell(tmwot); pdfTable.AddCell(new Phrase(totalAmt.ToString(), fontH1)); double cgst = gstrates.Where(x => x.Comodity.Equals("Stove")).FirstOrDefault().CGST; double sgst = gstrates.Where(x => x.Comodity.Equals("Stove")).FirstOrDefault().SGST; PdfPCell cgstCell = new PdfPCell(new Phrase("CGST :", fontH1)); cgstCell.Colspan = 3; pdfTable.AddCell(cgstCell); pdfTable.AddCell(new Phrase((totalAmt * cgst / 100).ToString(), fontH1)); PdfPCell sgstCell = new PdfPCell(new Phrase("SGST :", fontH1)); sgstCell.Colspan = 3; pdfTable.AddCell(sgstCell); pdfTable.AddCell(new Phrase((totalAmt * sgst / 100).ToString(), fontH1)); PdfPCell tmwt = new PdfPCell(new Phrase("Total Amount(with taxes) :", boldFont)); tmwt.Colspan = 3; pdfTable.AddCell(tmwt); pdfTable.AddCell(new Phrase(((100 + cgst + sgst) * totalAmt / 100).ToString(), boldFont)); PdfPCell tc = new PdfPCell(pdfTable); tc.Colspan = 2; pdfTable3.AddCell(tc); pdfTable3.AddCell(tc); var cell = new PdfPCell(new Phrase("\n\n'Your Safety is our Priority' In case of Emergency Call 1906 \nFor any complaints / Queries call: 1800 - 233 - 3555(Toll Free)", fontH1)); cell.Colspan = 2; pdfTable3.AddCell(cell); var cell1 = new PdfPCell(new Phrase("Declaration: I hereby confirm receipt of the filled LPG cylinder in sound condition and that the Cylinder was checked for weight & leakage.", fontH1)); pdfTable3.AddCell(cell1); var cell2 = new PdfPCell(new Phrase("\n\n\n" + "\t\t" + "Signature of Customer", fontH1)); cell2.HorizontalAlignment = Element.ALIGN_CENTER; pdfTable3.AddCell(cell2); #endregion #endregion SaveFileDialog sfd = new SaveFileDialog(); sfd.InitialDirectory = @"C:\"; sfd.RestoreDirectory = true; sfd.FileName = cashmemo.ToString(); sfd.DefaultExt = "pdf"; sfd.Filter = "Pdf Files|*.pdf"; if (sfd.ShowDialog() == DialogResult.OK) { string path = sfd.FileName; using (FileStream stream = new FileStream(path, FileMode.Create)) { Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); PdfWriter.GetInstance(pdfDoc, stream); pdfDoc.Open(); #region PAGE-1 pdfDoc.Add(pdfTable1); pdfDoc.Add(pdfTable2); pdfDoc.Add(pdfTable3); pdfDoc.NewPage(); #endregion pdfDoc.Close(); stream.Close(); } MessageBox.Show("Invoice is generated successfully!!!"); } } catch (Exception ex) { throw; } }
private static void PrintReceipt(TransactionMgnt.TxCylinder tx, CustomerMgntRef.Customer c) { Distributor dis = new Distributor(); string disName = dis.AgencyName; string disCode = dis.code.ToString(); string addr = dis.Address + ", " + dis.City + "\n" + "District: " + dis.District + ", State: " + dis.State; string phon = dis.ContectNo; string gstin = dis.GSTIN; int cashmemo = tx.CashMemoNo; int custNo = tx.CustomerId; string custName = tx.CustomerName; string date = tx.TxDate.ToShortDateString(); string custoAddr = c.Address + ", " + c.City + "\nDistrict: " + c.District + ", State: " + c.State + "-" + c.PinNo; string prod = tx.CylinderDetails; int qty = tx.Quentity; double price = tx.Price; double amount = tx.Amount; double cgst = tx.CGST; double sgst = tx.SGST; double totle = tx.Total; try { #region Page #region Section-1 iTextSharp.text.Font fontH1 = new iTextSharp.text.Font(BaseFont.CreateFont( BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED), 8, iTextSharp.text.Font.NORMAL); var boldFont = FontFactory.GetFont(FontFactory.TIMES_BOLD, 8); PdfPTable pdfTable1 = new PdfPTable(1);//Here 1 is Used For Count of Column PdfPTable pdfTable2 = new PdfPTable(4); PdfPTable pdfTable3 = new PdfPTable(4); pdfTable1.WidthPercentage = 100; pdfTable1.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfTable1.DefaultCell.VerticalAlignment = Element.ALIGN_CENTER; pdfTable1.DefaultCell.BorderWidth = 0; pdfTable2.WidthPercentage = 100; pdfTable2.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfTable2.DefaultCell.VerticalAlignment = Element.ALIGN_CENTER; pdfTable2.DefaultCell.BorderWidth = 0; pdfTable3.WidthPercentage = 100; pdfTable3.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; pdfTable3.DefaultCell.VerticalAlignment = Element.ALIGN_CENTER; pdfTable3.DefaultCell.BorderWidth = 0.5f; int[] firstTablecellwidth = { 7, 43, 7, 43 }; pdfTable2.SetWidths(firstTablecellwidth); string imageURL = @"./../Debug/Bill/logo.png"; iTextSharp.text.Image myImage = iTextSharp.text.Image.GetInstance(imageURL); myImage.ScaleToFit(38f, 38f); myImage.SpacingBefore = 5f; myImage.SpacingAfter = 10f; PdfPCell cellWithRowspan = new PdfPCell(myImage); cellWithRowspan.BorderWidth = 0.0f; cellWithRowspan.Rowspan = 3; cellWithRowspan.HorizontalAlignment = Element.ALIGN_RIGHT; pdfTable2.AddCell(cellWithRowspan); Chunk c1 = new Chunk(disName + " (" + disCode + ") ", FontFactory.GetFont("Times New Roman")); c1.Font.Color = new iTextSharp.text.BaseColor(255, 0, 0); c1.Font.SetStyle(0); c1.Font.Size = 10; Phrase p1 = new Phrase(); p1.Add(c1); pdfTable2.AddCell(p1); pdfTable2.AddCell(cellWithRowspan); Chunk c11 = new Chunk(disName + " (" + disCode + ") ", FontFactory.GetFont("Times New Roman")); c11.Font.Color = new iTextSharp.text.BaseColor(0, 0, 255); c11.Font.SetStyle(0); c11.Font.Size = 10; Phrase p11 = new Phrase(); p11.Add(c11); pdfTable2.AddCell(p11); Chunk c2 = new Chunk(addr, FontFactory.GetFont("Times New Roman")); c2.Font.Color = new iTextSharp.text.BaseColor(0, 0, 0); c2.Font.SetStyle(0);//0 For Normal Font c2.Font.Size = 8; Phrase p2 = new Phrase(); p2.Add(c2); pdfTable2.AddCell(p2); pdfTable2.AddCell(p2); Chunk c3 = new Chunk("Phone No : " + phon + " | GSTIN : " + gstin + "\n\n", FontFactory.GetFont("Times New Roman")); c3.Font.Color = new iTextSharp.text.BaseColor(0, 0, 0); c3.Font.SetStyle(0); c3.Font.Size = 8; Phrase p3 = new Phrase(); p3.Add(c3); pdfTable2.AddCell(p3); pdfTable2.AddCell(p3); #endregion #region section Table pdfTable3.AddCell(new Phrase("Cashmemo No.: ", fontH1)); pdfTable3.AddCell(new Phrase(cashmemo + "", fontH1)); pdfTable3.AddCell(new Phrase("Cashmemo No.: ", fontH1)); pdfTable3.AddCell(new Phrase(cashmemo + "", fontH1)); pdfTable3.AddCell(new Phrase("Customer ID: ", fontH1)); pdfTable3.AddCell(new Phrase(custNo + "", fontH1)); pdfTable3.AddCell(new Phrase("Customer ID: ", fontH1)); pdfTable3.AddCell(new Phrase(custNo + "", fontH1)); pdfTable3.AddCell(new Phrase("Customer Name: ", fontH1)); pdfTable3.AddCell(new Phrase(custName + "", fontH1)); pdfTable3.AddCell(new Phrase("Customer Name: ", fontH1)); pdfTable3.AddCell(new Phrase(custName + "", fontH1)); pdfTable3.AddCell(new Phrase("Transaction Date: ", fontH1)); pdfTable3.AddCell(new Phrase(date + "", fontH1)); pdfTable3.AddCell(new Phrase("Transaction Date: ", fontH1)); pdfTable3.AddCell(new Phrase(date + "", fontH1)); pdfTable3.AddCell(new Phrase("Address: ", fontH1)); pdfTable3.AddCell(new Phrase(custoAddr + "", fontH1)); pdfTable3.AddCell(new Phrase("Address: ", fontH1)); pdfTable3.AddCell(new Phrase(custoAddr + "", fontH1)); pdfTable3.AddCell(new Phrase("Product: ", fontH1)); pdfTable3.AddCell(new Phrase(prod + "", fontH1)); pdfTable3.AddCell(new Phrase("Product: ", fontH1)); pdfTable3.AddCell(new Phrase(prod + "", fontH1)); pdfTable3.AddCell(new Phrase("Price(Rs.): ", fontH1)); pdfTable3.AddCell(new Phrase(price + "", fontH1)); pdfTable3.AddCell(new Phrase("Price(Rs.): ", fontH1)); pdfTable3.AddCell(new Phrase(price + "", fontH1)); pdfTable3.AddCell(new Phrase("Quentity: ", fontH1)); pdfTable3.AddCell(new Phrase(qty + "", fontH1)); pdfTable3.AddCell(new Phrase("Quentity: ", fontH1)); pdfTable3.AddCell(new Phrase(qty + "", fontH1)); pdfTable3.AddCell(new Phrase("Amount (Quentity * Price) (Rs.): ", fontH1)); pdfTable3.AddCell(new Phrase(amount + "", fontH1)); pdfTable3.AddCell(new Phrase("Amount (Quentity * Price) (Rs.): ", fontH1)); pdfTable3.AddCell(new Phrase(amount + "", fontH1)); pdfTable3.AddCell(new Phrase("CGST(Rs.): ", fontH1)); pdfTable3.AddCell(new Phrase(cgst + "", fontH1)); pdfTable3.AddCell(new Phrase("CGST(Rs.): ", fontH1)); pdfTable3.AddCell(new Phrase(cgst + "", fontH1)); pdfTable3.AddCell(new Phrase("SGST(Rs.): ", fontH1)); pdfTable3.AddCell(new Phrase(sgst + "", fontH1)); pdfTable3.AddCell(new Phrase("SGST(Rs.): ", fontH1)); pdfTable3.AddCell(new Phrase(sgst + "", fontH1)); pdfTable3.AddCell(new Phrase("Total(Rs.): ", boldFont)); pdfTable3.AddCell(new Phrase(totle + "", boldFont)); pdfTable3.AddCell(new Phrase("Total(Rs.): ", boldFont)); pdfTable3.AddCell(new Phrase(totle + "", boldFont)); var cell = new PdfPCell(new Phrase("\n\n'Your Safety is our Priority' In case of Emergency Call 1906 \nFor any complaints / Queries call: 1800 - 233 - 3555(Toll Free)", fontH1)); cell.Colspan = 2; pdfTable3.AddCell(cell); var cell1 = new PdfPCell(new Phrase("Declaration: I hereby confirm receipt of the filled LPG cylinder in sound condition and that the Cylinder was checked for weight & leakage.", fontH1)); pdfTable3.AddCell(cell1); var cell2 = new PdfPCell(new Phrase("\n\n\n" + "\t\t" + "Signature of Customer", fontH1)); cell2.HorizontalAlignment = Element.ALIGN_CENTER; pdfTable3.AddCell(cell2); #endregion #endregion SaveFileDialog sfd = new SaveFileDialog(); sfd.InitialDirectory = @"C:\"; sfd.RestoreDirectory = true; sfd.FileName = cashmemo.ToString(); sfd.DefaultExt = "pdf"; sfd.Filter = "Pdf Files|*.pdf"; if (sfd.ShowDialog() == DialogResult.OK) { string path = sfd.FileName; using (FileStream stream = new FileStream(path, FileMode.Create)) { Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); PdfWriter.GetInstance(pdfDoc, stream); pdfDoc.Open(); #region PAGE-1 pdfDoc.Add(pdfTable1); pdfDoc.Add(pdfTable2); pdfDoc.Add(pdfTable3); pdfDoc.NewPage(); #endregion pdfDoc.Close(); stream.Close(); } MessageBox.Show("Invoice is generated successfully!!!"); } } catch (Exception ex) { throw; } }