Different margins with pagination
Hello,
i draw a multiline textelement using
layoutFormat = PdfLayoutFormat(
layoutType: PdfLayoutType.paginate,
breakType: PdfLayoutBreakType.fitPage);
Thats works fine. if the text fit on page1, a second page is created and the text continues on page 2.
But is it possible to set different margings on page1 and page2?
Or ist it possible to draw the text with
PdfLayoutFormat(
layoutType: PdfLayoutType.onePage,
breakType: PdfLayoutBreakType.fitPage);
After that i would handle the page break by myself, but then i need the clipped part of the text to draw it on the 2nd page.
Thanks for replies.
Sebastian
Hi Sebastian,
Currently, it is not possible to set different margins for each page when using the PdfLayoutFormat with PdfLayoutType.paginate. The layout engine applies a consistent layout configuration across all pages during pagination.
Nevertheless, your requirement can be met by setting custom pagination bounds to simulate different margins—such as adding extra space at the top of the second and subsequent pages. This approach allows you to control the layout more precisely during pagination.
Here’s a code example demonstrating how to set the PaginateBounds to leave space at the top of the second page:
|
PdfGridLayoutFormat format = new PdfGridLayoutFormat(); // Set custom pagination bounds to add top margin on subsequent pages format.PaginateBounds = new Syncfusion.Drawing.RectangleF( 0, 15, page.GetClientSize().Width, page.GetClientSize().Height - 15 );
|
In this example:
- 15 units of space are added at the top.
- The height is reduced accordingly to maintain the layout within the page.
Follow the below links for more information:
Changing margins from the second page onwards
Regards,
Irfana J.
If I remove the bold styling, it fits 99% of the header values (some of the longer ones still get slightly cut off), but with the bold styling enabled
Hi Sebastian,
We were unable to reproduce the issue with the provided details on our end. We request you to share with us the simplified sample to replicate the issue on our end. So that we can assist with you further in this.
Regards,
Irfana J.
Похоже, что действительно невозможно задать разные поля на первой и последующих страницах при использовании PdfLayoutFormat с типом paginate, но, судя по ответу от команды Syncfusion, можно обойти это, задав собственные границы пагинации
Could you clarify how to apply `PaginateBounds` to create space at the top of subsequent pages?
I'm not sure how to adjust the height to maintain the layout accurately in the PDF document.
Thank you!
Hi @Seraphina,
To introduce top spacing (margin) on subsequent pages when using PdfTextElement.draw, you can utilize the PdfLayoutFormat.paginateBounds property. By default, when content flows onto a new page, it starts at (0, 0) (top-left). Using paginateBounds, you can define the starting position of content on each overflow page.
The following code snippet shows how to apply the paginateBounds property:
Could you please let us know if this explanation helps you create space at the top of subsequent pages?
Regards,
Abinaya E
Would you mind clarifying how to utilize PaginateBounds to create a top margin on pages after the first one?
I'm having trouble determining how the height FNAF 4 should be adjusted to keep the PDF layout consistent.
Hi Maria Charles,
If we need a top space on the pages, then we should adjust the Y position of the page.
If we need to determine the height of the pages, then we should first set the maximum height available. After that, we need to reduce the top space from that maximum height, and then we can determine the final height to maintain a consistent layout.
Code snippet:
paginateBounds = Rect.fromLTWH(
0,
topMargin,
pageSize.width,
pageSize.height - topMargin,
);
Could you please let us know if this explanation helps you determine the final height and maintain a consistent layout?
Regards,
Abinaya E
@Her Trees, I find the explanation about pagination and margins very clear, especially the note that margins are applied consistently across pages and that custom pagination bounds can be used as a workaround.
Hi Haven David,
Thank you for your response. Please get in touch with us if you would require any further assistance.
Regards,
Abinaya E
- 10 Replies
- 8 Participants
-
SW Sebastian Wulf - ma/soft
- Jun 27, 2025 09:06 AM UTC
- Jun 23, 2026 12:32 PM UTC