Certainly! Here’s an example of a C# class that uses the iTextSharp library to generate a PDF report:

using System;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;

public class PdfReportGenerator
{
    private Document document;
    private PdfPTable table;
    private string filePath;

    public PdfReportGenerator(string filePath)
    {
        this.filePath = filePath;
    }

    public void GenerateReport(string[] headers, string[][] data)
    {
        using (FileStream stream = new FileStream(filePath, FileMode.Create))
        {
            document = new Document();
            PdfWriter writer = PdfWriter.GetInstance(document, stream);

            document.Open();

            // Create the table
            table = new PdfPTable(headers.Length);
            table.WidthPercentage = 100;
            table.SetWidths(GetColumnWidths(headers.Length));

            // Add headers to the table
            foreach (string header in headers)
            {
                PdfPCell cell = new PdfPCell(new Phrase(header));
                cell.HorizontalAlignment = Element.ALIGN_CENTER;
                table.AddCell(cell);
            }

            // Add data rows to the table
            foreach (string[] row in data)
            {
                foreach (string cellData in row)
                {
                    PdfPCell cell = new PdfPCell(new Phrase(cellData));
                    cell.HorizontalAlignment = Element.ALIGN_CENTER;
                    table.AddCell(cell);
                }
            }

            // Add the table to the document
            document.Add(table);

            document.Close();
            writer.Close();
            stream.Close();
        }
    }

    private float[] GetColumnWidths(int numColumns)
    {
        float[] widths = new float[numColumns];
        for (int i = 0; i < numColumns; i++)
        {
            widths[i] = 1f;
        }
        return widths;
    }
}

To use this class, you would need to install the iTextSharp library. You can do this by right-clicking on your project in Visual Studio, selecting “Manage NuGet Packages,” and searching for “iTextSharp” to install the package.

Here’s an example of how you can use the PdfReportGenerator class to generate a PDF report:

string filePath = "report.pdf";
string[] headers = { "Name", "Age", "City" };
string[][] data = {
    new string[] { "John Doe", "30", "New York" },
    new string[] { "Jane Smith", "25", "London" },
    new string[] { "Bob Johnson", "35", "Paris" }
};

PdfReportGenerator reportGenerator = new PdfReportGenerator(filePath);
reportGenerator.GenerateReport(headers, data);

Console.WriteLine("PDF report generated successfully.");

string filePath = “report.pdf”;
string[] headers = { “Name”, “Age”, “City” };
string[][] data = {
new string[] { “John Doe”, “30”, “New York” },
new string[] { “Jane Smith”, “25”, “London” },
new string[] { “Bob Johnson”, “35”, “Paris” }
};

PdfReportGenerator reportGenerator = new PdfReportGenerator(filePath);
reportGenerator.GenerateReport(headers, data);

Console.WriteLine(“PDF report generated successfully.”);