How to Draw Multiple Pages with Pagination in WinForms PDF?
You can draw multiple pages with pagination by using the PdfTextElement class available under the Syncfusion.Pdf.Graphics namespace in our WinForms PDF page.
Refer to the following code example to draw the text by using the PdfTextElement.
C#
public void AddTextElement(string text, PdfFont font, float delay, int space, PdfBrush brush)
{
var prefixSpace = new string(' ', space);
// Creating Pdf text element
PdfTextElement textElement = new PdfTextElement(prefixSpace + text) { Font = font };
// Setting the brush to the element
textElement.Brush = brush;
if (CurrentPage.GetClientSize().Height - _yPos <= font.Size)
{
_yPos += delay;
}
// Drawing the text element on the page and getting the layout result
PdfLayoutResult result = textElement.Draw(CurrentPage, StartingPoint);
// Getting the text element bottom position to draw the next element
var newYpos = result.Bounds.Bottom + delay;
_yPos = newYpos;
}
Conclusion
I hope you enjoyed learning how to draw multiple pages with pagination in WinForms PDF.
You can refer to our WinForms PDF feature tour page to learn about its other groundbreaking features and documentation, and how to quickly get started with configuration specifications. You can also explore our WinForms PDF examples to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums or feedback portal. We are always happy to assist you!