I have a huge text content which will fit usually in more than one page but when i use the below code, the text ends by the end of the first page and it doesn't create a second page. Is there a feature to do this automatically or this need to be handled grammatically and what is the best approach (depending on text length or !! )
- Code: Select all
//Document is just internal class for my data
private void AddContent(PdfPageBase page, Document document)
{
PdfBrush solidBrush = new PdfSolidBrush(Color.Black);
System.Drawing.Font contentFont = new System.Drawing.Font("Arial", 12f, FontStyle.Regular);
PdfTrueTypeFont contentTrueTypeFont = new PdfTrueTypeFont(contentFont);
contentTrueTypeFont = new PdfTrueTypeFont(contentFont, true);
RectangleF rctgContent = new RectangleF(page.Canvas.ClientSize.Width * 0.25f, 70, page.Canvas.ClientSize.Width * 0.75f, page.Canvas.ClientSize.Height);
PdfStringFormat rightFormat = new PdfStringFormat(PdfTextAlignment.Right);
rightFormat.RightToLeft = true;
page.Canvas.DrawString(document.Content + document.Content, contentTrueTypeFont, solidBrush, rctgContent, rightFormat);
RectangleF rctgImage = new RectangleF(0, 70, page.Canvas.ClientSize.Width * 0.25f, page.Canvas.ClientSize.Width * 0.25f);
Image img = GetImage(document.PhotosUrls[0]);
PdfImage image = PdfImage.FromImage(img);
page.Canvas.DrawImage(image, rctgImage);
page.Canvas.SetTransparency(1);
}