PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Apr 26, 2024 5:35 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Mon Apr 18, 2011 4:55 pm 
Offline

Joined: Thu Jul 16, 2009 2:38 pm
Posts: 16
Hello,

How to print a total field only on last page of mutiple page invoice?

thanks,
Valeriano


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 19, 2011 8:20 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Total pages? There is a field that you can add to any paragraph. Add it to a paragraph on the last page.
If you add it to header or footer, it'll show on any page.

You can add a TextFrame to the last page to show the total add a fixed position.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 19, 2011 10:15 am 
Offline

Joined: Thu Jul 16, 2009 2:38 pm
Posts: 16
sorry,

i refer to the total of invoice.

Into footer section i've a table with the total of invoice (and other informaiton). If the invoce has two or more pages
the total of invoice must be only in the last page.

thanks
Valeriano


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 19, 2011 1:42 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
As I wrote: don't put it in the footer, add it to the last page only.
Use a TextFrame to have it at a certain position.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon May 23, 2011 9:47 am 
Offline

Joined: Thu Jul 16, 2009 2:38 pm
Posts: 16
I've a table with some fields.
this table must be show in all page but some cell content only
in the last page. How can i do this?


Top
 Profile  
Reply with quote  
PostPosted: Mon May 23, 2011 1:21 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
sfvaleriano wrote:
How can i do this?

More details would be good.

Will one page do sometimes or will there always be more than 1 pages?

Heading rows will appear on every page on top of the table. Is that what you need?

If you know that x rows fit a single page, start a new page and a new table after each set of x rows. Add the extra fields only on the last page.

Maybe you can use Header or Footer to do the trick. But that depends on your needs.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon May 23, 2011 3:01 pm 
Offline

Joined: Thu Jul 16, 2009 2:38 pm
Posts: 16
My problem is always the same: to show the total of a bill only on the last page.
The document may have one or more pages. In the footer of the document is a table showing the totals. If the document is a page there are no problems. But if the document has multiple pages then the first pages to be displayed in the table with empty cells and the last page should be displayed the same table but with the value set of cells, in my case the total value of the invoice. As in the attached pictures

first page
Attachment:
File comment: First Page
Page_1.jpg
Page_1.jpg [ 92.37 KiB | Viewed 12089 times ]


last page:
Attachment:
File comment: Last Page
Page_2.jpg
Page_2.jpg [ 84.14 KiB | Viewed 12089 times ]


Thanks
Valeriano


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 07, 2016 2:21 pm 
Offline
User avatar

Joined: Sun Apr 22, 2012 3:47 pm
Posts: 26
I need to do this as well. The invoice that I have created shows a Totals amount at the bottom in the document footer. If the invoice being rendered is going to be more than 1 page, I need the Totals amount in the footer to show "(continued next page)" until the last page where the actual amount will display. Is there a way to determine what page the renderer is on so that I can display "(continued next page)" until it gets to the last page where I can put the actual amount then?

For example:
Code:
                    if (renderer.currentpage != documents.lastpage) {
                        par = totalsRow.Cells[1].AddParagraph("(continued next page)");
                    }else {
                        par = totalsRow.Cells[1].AddParagraph(InvoiceTotal.ToString("c"));
                    }


Thank you,
George

_________________
Thanks,
George


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 07, 2016 2:32 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 916
Location: CCAA
Hi!
ghendric wrote:
Is there a way to determine what page the renderer is on so that I can display "(continued next page)" until it gets to the last page where I can put the actual amount then?
You can use the approach shown by the Mix MigraDoc And PDFsharp sample to create the PDF file page by page. Then you can use PDFsharp to add "(continued next page)" where appropriate.
I accomplished a similar task, but don't have sample code to share.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 07, 2016 2:41 pm 
Offline
User avatar

Joined: Sun Apr 22, 2012 3:47 pm
Posts: 26
Do you have a link to the sample?

_________________
Thanks,
George


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 07, 2016 3:28 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 916
Location: CCAA
ghendric wrote:
Do you have a link to the sample?
I didn't publish my code yet - it was meant to be published as a sample, but I didn't find the time yet to clean it up.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 07, 2016 4:20 pm 
Offline
User avatar

Joined: Sun Apr 22, 2012 3:47 pm
Posts: 26
I'm kind of getting what i want from the Document.LastSection object but its putting my text up in the body instead of down in the footer. Am I close? :D

It would nice to have a AddParagraphLastSection method off of a Table or Row.Cell, etc... object with 2 parameters where the first parameter would print on the document on each page except the last and the 2 parameter would print on the last page instead..

Something like this:
Code:
Table mainTbl = sec.Footers.Primary.AddTable();
Row mainRow = mainTbl.AddRow();
TextFrame tfTotals = mainRow.Cells[1].AddTextFrame();
Table tblTotals = tfTotals.AddTable();
Row totalsRow = tblTotals.AddRow();
par = totalsRow.Cells[1].AddParagraphLastSection("(continued next page)", InvoiceTotal.ToString("c"));

_________________
Thanks,
George


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 08, 2016 4:30 pm 
Offline
User avatar

Joined: Sun Apr 22, 2012 3:47 pm
Posts: 26
I'm really stuck on this. Can you point me in the right direction?

_________________
Thanks,
George


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 326 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:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group