Please have a look at below code
listView1.View = View.Details;
listView1.GridLines = true;
listView1.FullRowSelect = false;
listView1.Columns.Add("ProductName", 100);
listView1.Columns.Add("Price", 70);
listView1.Columns.Add("Quantity", 70);
string[] arr = new string[4];
ListViewItem itm;
arr[0] = "product_1";
arr[1] = "100";
arr[2] = "10";
itm = new ListViewItem(arr);
listView1.Items.Add(itm);
arr[0] = "product_2";
arr[1] = "200";
arr[2] = "20";
itm = new ListViewItem(arr);
listView1.Items.Add(itm);
PdfPTable pdfTable = new PdfPTable(listView1.Columns.Count);
pdfTable.DefaultCell.Padding = 3;
pdfTable.WidthPercentage = 30;
pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;
pdfTable.DefaultCell.BorderWidth = 1;
foreach (ColumnHeader column in listView1.Columns)
{
PdfPCell cell = new PdfPCell(new Phrase(column.Text));
pdfTable.AddCell(cell);
}
foreach (ListViewItem itemRow in listView1.Items)
{
int i = 0;
for (i = 0; i < itemRow.SubItems.Count - 1; i++)
{
pdfTable.AddCell(itemRow.SubItems[i].Text);
}
}
string folderPath = @"D:/Temp/";
if (!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath);
}
using (FileStream stream = new FileStream(folderPath + "DataGridViewExport.pdf", FileMode.Create))
{
Document pdfDoc = new Document(PageSize.A2, 10f, 10f, 10f, 0f);
PdfWriter.GetInstance(pdfDoc, stream);
pdfDoc.Open();
pdfDoc.Add(pdfTable);
pdfDoc.Close();
stream.Close();
}