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.