Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri Mar 15, 2013 7:16 am

Hello,
I would like to prevent a page break, as it follows:

I have a table which is filled dinamically with data and after it, another 2 small tables with fixed dimensions. The problem is, that i want the 2 small tables to be grouped, in case of a page break (when the first table has so much rows that it pushes the other 2 tables down). And it seems that the "keep these lines together" setting does not work in Spire.PDF.
Any idea? thanks.

catalin
 
Posts: 48
Joined: Wed Mar 14, 2012 12:56 pm

Fri Mar 15, 2013 10:18 am

Dear Catalin,

Thanks for your inquiry.
We provide you a demo. Please refer to it to draw your tables. If you still have the problem, please provide us your data and a picture to show the output what you want to implement. After that we will provide you a demo to help you solve this issue.
Thank you in advance!

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed Mar 20, 2013 10:31 am

Dear Catalin,

Do you refer to the demo we provided you? Does it solve this issue?
Please give us a feedback on this issue at your early convenience. Thank you!
If you have any issue, please tell us.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Thu Aug 22, 2013 8:20 am

Could you please offer me a solution that would work also in Spire.Doc?
Thank you

catalin
 
Posts: 48
Joined: Wed Mar 14, 2012 12:56 pm

Wed Sep 04, 2013 9:11 am

Dear Catalin,

Sorry for the delay response.
You could try mailmerge function in Spire.Doc.
We provide you a demo in the attachment.

Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed Sep 11, 2013 1:00 pm

amy.zhao wrote:Dear Catalin,

Sorry for the delay response.
You could try mailmerge function in Spire.Doc.
We provide you a demo in the attachment.

Regards,
Amy
E-iceblue support team


Well, it seems that there are missing some files. Thanks.

catalin
 
Posts: 48
Joined: Wed Mar 14, 2012 12:56 pm

Thu Sep 12, 2013 2:18 am

Dear Catalin,

Thanks for your feedback.
The demo didn't contain the dll files because the maximum upload size is 2 MB.
Please try to add Spire.Doc.dll to it before run the demo.

Best regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed Sep 18, 2013 9:00 am

Dear Catalin,

Does the demo solve your issue?
Please give us a feedback at your convenience. Thank you!

Best regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Thu Sep 26, 2013 6:27 am

Im sorry, Visual Studio says that app.Config and Program.cs files are missing. I cant run the demo.

catalin
 
Posts: 48
Joined: Wed Mar 14, 2012 12:56 pm

Thu Sep 26, 2013 7:25 am

Dear Catalin,

Sorry for that. It is my fault.
I attached a new demo. Please try to run it after adding the dll files.
And I sent a live demo to you by e-mail.

Best regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Thu Oct 03, 2013 12:00 pm

Actually, what have i requested is a little bit something else.

I didn't mean how to fill a table with data, but rather how can i check for example at the end of the table, if the table stretches on more than a page. Is there any posibility in Spire.Doc to check at any moment the number of the current page? I already noticed on forum that document.BuitInProperties.PageCount doesn't work properly.

catalin
 
Posts: 48
Joined: Wed Mar 14, 2012 12:56 pm

Fri Oct 04, 2013 8:04 am

It looks like you need to draw 3 table in a PDF file. And you want also make sure that the second table and the third table are placed in the same page. If that, please try:
1. Please refer our demo Table/TableLayout in our SampleCenter (included in installation package), and draw your first table in doc1, you can get the last page and end point of the first table from a PdfLayoutResult object.
2. Create a temp document to draw the second table and the third table. And you can get the height of your second and third table.
3. If the last page of doc1 has enough space, just draw the temp document to the last page. Otherwise, create a new page and the draw the temp document.
Code: Select all
PdfTableLayoutFormat tableLayout = new PdfTableLayoutFormat();
tableLayout.Break = PdfLayoutBreakType.FitElement;
tableLayout.Layout = PdfLayoutType.Paginate;
PdfLayoutResult result = table.Draw(page, new PointF(0, y), tableLayout);
y = result.Bounds.Bottom + 5;

//Create pdf template to layout small tables;
PdfDocument temp = new PdfDocument();

//draw small tables
PdfPageBase tempPage = temp.Pages.Add(page.Canvas.ClientSize, new PdfMargins(0));
PdfLayoutResult result2 = DrawSmallTables(tempPage);
float height = result2.Bounds.Bottom;
if (page.Canvas.ClientSize.Height - y >= height)
{
   tempPage.CreateTemplate().Draw(result.Page.Canvas, new PointF(0, y));
}
else
{
   page = doc.Pages.Add(PdfPageSize.A4, margin);
   tempPage.CreateTemplate().Draw(page, PointF.Empty);
}

A full demo is attached, please check it.
If we missed your requirement again, please provide us your data original and the document expected.
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

harry.support
 
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Wed Oct 09, 2013 3:25 am

Dear Catalin,

Sorry that our Spire.Doc doesn't have a property or method to get the number of the current page at present.

Best regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Tue Sep 26, 2017 8:09 am

So, I have a pdf page contains some tables with dynamic value,
Ex: my first table contain 10, second table contain 100, and third table contain 1 row.
assume the first page is enough with my first table, so the second table had to be in a new page, and it works fine, and actually the last page has enough empty spot to fill with the third table, but in reality, the third table is draw on the empty spot in the first page, I mean which is the rest empty spot on the last page can't read and it just continue from the first page, before I add the new page for the second table.
How do I make it work so all my table is read the actual last page?

Hope u understand my problem :(

mels
 
Posts: 3
Joined: Tue Aug 22, 2017 3:52 am

Tue Sep 26, 2017 9:08 am

Hello,

It seems that there is something wrong on your codes, so could you please show the codes that demonstrate the process of drawing the three tables?

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.PDF