Wish to read a table in a PDF file using C#.net.
I wish to read a table in a PDF file using C#.net.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
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 attend4days leftRegister
bret6 reputationPosted Mar 23, 2009, 7:08 AM EDT
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Mar 23, 2009, 9:03 AM EDT
//See http://itextsharp.sourceforge.net/tutorial/ch05.html
public bool Chap0501(string sFilePDF)
{
bool bRet = false;
Debug.WriteLine("Chapter 5 example 1: My First Table");
// step 1: creation of a document-object
Document document = new Document();
try
{
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter writer = PdfWriter.GetInstance(document,
new FileStream(sFilePDF, FileMode.Create));
// step 3: we open the document
document.Open();
// step 4: we create a table and add it to the document
Table aTable = new Table(2, 2); // 2 rows, 2 columns
aTable.AddCell("0.0");
aTable.AddCell("0.1");
aTable.AddCell("1.0");
aTable.AddCell("1.1");
document.Add(aTable);
bRet = true;
}
catch (DocumentException de)
{
this.Message = de.Message;
}
catch (IOException ioe)
{
this.Message = ioe.Message;
}
// step 5: we close the document
document.Close();
if (bRet)
this.Message = sFilePDF + " has been created";
return bRet;
}