i want to extract the data and want to convert it to pdf from oracle.
Loading
i want to extract the data and want to convert it to pdf from oracle.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Tuhin PaulRank #7 · 71.9K reputationPosted Mar 2, 2023, 1:32 PM EST
Hello!
Data from Oracle and convert it to PDF, see below the steps:
Here is some sample C# code that shows how to extract data from Oracle and convert it to PDF using iTextSharp:
// Establish connection to Oracle database using (var conn = new OracleConnection(connectionString)) { conn.Open(); // Create command to select data var command = new OracleCommand(sql, conn); // Execute command and get data reader using (var reader = command.ExecuteReader()) { // Create new PDF document var doc = new Document(); // Create PDF writer and attach it to document var writer = PdfWriter.GetInstance(doc, new FileStream(outputFilePath, FileMode.Create)); doc.Open(); // Iterate over data reader and add rows to PDF table while (reader.Read()) { var table = new PdfPTable(reader.FieldCount); for (int i = 0; i < reader.FieldCount; i++) { table.AddCell(reader.GetValue(i).ToString()); } doc.Add(table); } // Close PDF document doc.Close(); } }This code assumes that you have already established a connection to the Oracle database using an appropriate connection string, and have defined the SQL query to select the data you want to extract in the sql variable.