0

I'm using iTextSharp Library to build PDFs. I'm trying to develop an application for certification (auto generator). and every time I'm getting an error

"The Document has no pages"

as exception. here i build a PDF document

using (Document pdoc = new Document(PageSize.A4.Rotate(), 2, 2, 10, 10))

and saw some similar questions and the solution was there that the developer do not add next at all to the document.

Here is the question

here i add some text to the document and still getting that exception.

pdoc.Add(EnglishTable);
pdoc.Add(HebrewTable);
pdoc.Add(ArabicTable);

i build the tables in this way

PdfPTable HebrewTable = new PdfPTable(1);
PdfPTable ArabicTable = new PdfPTable(1);
PdfPTable EnglishTable = new PdfPTable(1);

setting the Direction

HebrewTable.RunDirection = PdfWriter.RUN_DIRECTION_RTL;
ArabicTable.RunDirection = PdfWriter.RUN_DIRECTION_RTL;
EnglishTable.RunDirection = PdfWriter.RUN_DIRECTION_LTR;

and i take some text from excel file and add it to the tables. and still getting that error.

odaiwa
  • 315
  • 2
  • 14
  • Please share enough code to easily reproduce the issue. If I consider the code pieces you shared, it looks like you add no content to the tables, and empty tables add nothing to the document. – mkl Jan 30 '21 at 19:41
  • I echo @mkl's sentiments. This question needs a full code sample to debug. With the small set of snippets you have provided so far its impossible to tell why you are seeing the issue. – Ocean Airdrop Jan 31 '21 at 15:05
  • Thanks guys the code has worked perfectly, i don't what was the problem exacly. – odaiwa Jan 31 '21 at 21:28
  • I'm adding content to the tables data from excel file. – odaiwa Jan 31 '21 at 21:29

0 Answers0