0

I wanted to export an arabic data listed in a dataGridView.

so i used iTestSharp for this.

PdfPTable pdfTable = new PdfPTable(dataGridView1.Columns.Count);
                        pdfTable.DefaultCell.Padding = 3;
                        pdfTable.WidthPercentage = 100;
                        pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;
                        iTextSharp.text.Font fts = new iTextSharp.text.Font();
                  
                    
                        foreach (DataGridViewColumn column in dataGridView1.Columns)
                        {
                            PdfPCell cell = new PdfPCell(new Phrase(column.HeaderText));
                            pdfTable.AddCell(cell);
                        }

                        foreach (DataGridViewRow row in dataGridView1.Rows)
                        {
                            foreach (DataGridViewCell cell in row.Cells)
                            {
                                pdfTable.AddCell(cell.Value.ToString());
                            }
                        }

                        using (FileStream stream = new FileStream("Output.pdf", FileMode.Create))
                        {
                            Document pdfDoc = new Document(PageSize.A4, 10f, 20f, 20f, 10f);
                            PdfWriter.GetInstance(pdfDoc, new FileStream("123", FileMode.Create));
                            pdfDoc.Open();
                            pdfDoc.Add(new Paragraph("ID:"));
                            pdfDoc.Close();
                            stream.Close();
                        }

sadly, it doesnt work. i searched for more than 20 hours for this.

i used pdf Printer/ spire pdc,abcpdf.

i tried this iTestSharp pdfCalligraph but it doesnt work. any help is appreciated.

Etch
  • 3
  • 3
  • `sadly, it doesnt work.` - sadly, you don’t explain what fails to work. – Rand Random Jul 30 '22 at 17:23
  • i want to save arabic words into pdf file. – Etch Jul 30 '22 at 20:32
  • See [Display Unicode characters in converting Html to Pdf](https://stackoverflow.com/questions/10329863/display-unicode-characters-in-converting-html-to-pdf) and [Arabic in pdf using iTextSharp in c#](https://stackoverflow.com/questions/34528259/arabic-in-pdf-using-itextsharp-in-c-sharp). – dr.null Jul 30 '22 at 23:21
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jul 31 '22 at 09:56

0 Answers0