Hi, when im writing into my newly created pdf, i am encountering a text overlapping issue.
Here is part of my code:
I'm trying to add lines from my list to the pdf,
page.Canvas.DrawString(ls[linenumber - 5], new PdfFont(PdfFontFamily.TimesRoman, 9f), new PdfSolidBrush(Color.Black), 5, start+5);
page.Canvas.DrawString(ls[linenumber - 4], new PdfFont(PdfFontFamily.TimesRoman, 9f), new PdfSolidBrush(Color.Black), 5, start+15);
page.Canvas.DrawString(ls[linenumber - 3], new PdfFont(PdfFontFamily.TimesRoman, 9f), new PdfSolidBrush(Color.Black), 5, start+25);
page.Canvas.DrawString(ls[linenumber - 2], new PdfFont(PdfFontFamily.TimesRoman, 9f), new PdfSolidBrush(Color.Black), 5, start+35);
page.Canvas.DrawString(ls[linenumber - 1], new PdfFont(PdfFontFamily.TimesRoman, 9f), new PdfSolidBrush(Color.Black), 5, start+45);
page.Canvas.DrawString(ls[linenumber], new PdfFont(PdfFontFamily.TimesRoman, 9f), new PdfSolidBrush(Color.Black), 5, start+55);
total there are 12 lines, but the result is 6 line overlapping each other, i wonder what did i do wrong.
below is the code i used to create the new document
PdfDocument doc2 = new PdfDocument();
PdfPageBase page = doc2.Pages.Add();
PdfUnitConvertor unitCvtr = new PdfUnitConvertor();
PdfMargins margin = new PdfMargins();
margin.Top = unitCvtr.ConvertUnits(2.54f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
margin.Bottom = margin.Top;
margin.Left = unitCvtr.ConvertUnits(3.17f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
margin.Right = margin.Left;
PdfSection section = doc2.Sections.Add();
section.PageSettings.Size = PdfPageSize.A4;
section.PageSettings.Margins = margin;
section = doc2.Sections.Add();
section.PageSettings.Margins = margin;
page = section.Pages.Add();