PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Does MigraDoc or PdfSharp support automatic pagebreak?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3710
Page 1 of 1

Author:  TOMO [ Tue Jan 16, 2018 10:48 am ]
Post subject:  Does MigraDoc or PdfSharp support automatic pagebreak?

Hi all

I have a small C# program converting a number of invoice line items to a pdf-file using MigraDoc/PdfSmart.

I need to make a pagebreak inside a table in case the number of lines exceeds what can be shown on one page.

Is there a way to do this automatically when a certain number of lines is printed/added to the table og do I have to do this "manually". In both cases - how do I do that (being complete new to MigraDoc/PdfSharp).

Regards
Tomo

Author:  Thomas Hoevel [ Tue Jan 16, 2018 11:03 am ]
Post subject:  Re: Does MigraDoc or PdfSharp support automatic pagebreak?

Hi!

MigraDoc will add the page breaks automatically - and you have to do nothing to get it.
MigraDoc does not yet break table rows, so make sure each table row fits on a single page.

http://www.pdfsharp.net/wiki/Invoice-sample.ashx

Author:  TOMO [ Tue Jan 16, 2018 2:23 pm ]
Post subject:  Re: Does MigraDoc or PdfSharp support automatic pagebreak?

Hi Thomas

Well, yes, that worked partly. However, when I run my code a pagebreak seems to be launched but on the second page the invoice table is written on top of the header which I have added. I would like the table to continue below the header. Have you any idea what could be wrong?
The header is placed right where it should and on the first page the invoice table begins where it should (below the header).

Best regards
Tomo

Author:  Thomas Hoevel [ Tue Jan 16, 2018 2:27 pm ]
Post subject:  Re: Does MigraDoc or PdfSharp support automatic pagebreak?

The top margin of the page must be large enough for the header.
Text will overlap if you only reserve 1 cm for a 5 cm header.

Author:  TOMO [ Tue Jan 16, 2018 2:50 pm ]
Post subject:  Re: Does MigraDoc or PdfSharp support automatic pagebreak?

Sounds reasonable. Fixed that.

Is it possible to detect when a pagebreak is fired e.g. when iterating over a number of invoice items? The reason I ask is that I would like to add a bottom border to the last row in the table on each page.

/Tomo

Author:  Thomas Hoevel [ Wed Jan 17, 2018 8:58 am ]
Post subject:  Re: Does MigraDoc or PdfSharp support automatic pagebreak?

TOMO wrote:
Is it possible to detect when a pagebreak is fired e.g. when iterating over a number of invoice items?
No.
When creating RTF, page breaks are generated by Word.
When creating PDF, page breaks are generated by the MigraDoc renderer while preparing the document.
It is possible to prepare the document, analyze the page breaks, add borders to table rows and finally prepare and render the modified document.

Author:  TOMO [ Thu Jan 18, 2018 12:23 pm ]
Post subject:  Re: Does MigraDoc or PdfSharp support automatic pagebreak?

Hi Thomas

Thank you for answering.

Best regards
Tomo

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/