PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 11:11 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Tue Jan 16, 2018 10:48 am 
Offline

Joined: Tue Jan 16, 2018 10:21 am
Posts: 8
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


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 16, 2018 11:03 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 16, 2018 2:23 pm 
Offline

Joined: Tue Jan 16, 2018 10:21 am
Posts: 8
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


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 16, 2018 2:27 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 16, 2018 2:50 pm 
Offline

Joined: Tue Jan 16, 2018 10:21 am
Posts: 8
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


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 17, 2018 8:58 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 18, 2018 12:23 pm 
Offline

Joined: Tue Jan 16, 2018 10:21 am
Posts: 8
Hi Thomas

Thank you for answering.

Best regards
Tomo


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 118 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group