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.

Thu Mar 22, 2018 8:02 pm

Hello,

I use free version to create PDF files and faced with the following problem.

When you dynamically generate PDF and one of tables gets too long you can not break it onto two pages
and calculate if it needs to be broken onto a few pages or how to move part of this long table to another page.

Any suggestion, please.

Thank you

vozmen
 
Posts: 15
Joined: Thu Mar 22, 2018 7:44 pm

Fri Mar 23, 2018 8:27 am

Hello,

Thanks for your inquiry.
Sorry there is no direct way to break the long table and draw them into two pages. However, you could split your DataTable into two or more DateTables, then draw them into different Pdf pages. If you can accept this solution, you can provide your expected effect with us, we will look into it and provide a demo accordingly.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Fri Mar 23, 2018 10:42 am

Here is some visual explanation attached:
Spire.Pdf.png



Nina.Tang wrote:Hello,

Thanks for your inquiry.
Sorry there is no direct way to break the long table and draw them into two pages. However, you could split your DataTable into two or more DateTables, then draw them into different Pdf pages. If you can accept this solution, you can provide your expected effect with us, we will look into it and provide a demo accordingly.

Sincerely,
Nina
E-iceblue support team

vozmen
 
Posts: 15
Joined: Thu Mar 22, 2018 7:44 pm

Mon Mar 26, 2018 9:24 am

Hello,

Thank you for sharing information.
I need to confirm some information with you. Is the attached picture generated by our product? Or is it your expected effect? I noticed that the table 4 in the picture is drawn on two pages. And about your description "Table 5 that just goes to under the table 4...". Your meaning is that the Table 5 should be drawn on second page ( followed the end of the Table 4 ), but is it drawn on the top of the Table 4 now? Could you please share further detailed information to clear our confusion on your requirement? Thanks in advance.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Mon Mar 26, 2018 9:32 am

"Is the attached picture generated by our product?" - yes. if the table 4 is not so long everything fit to one page and tables 5 and 6 goes down under the table 4 and everything looks fine.

"Your meaning is that the Table 5 should be drawn on second page ( followed the end of the Table 4 )" - yes. on the screenshot the Table 4 is very long and thus goes to the second page and for some reason Table 5 and 6 are put over it instead of go onto second page as well.

Thank you

Nina.Tang wrote:Hello,

Thank you for sharing information.
I need to confirm some information with you. Is the attached picture generated by our product? Or is it your expected effect? I noticed that the table 4 in the picture is drawn on two pages. And about your description "Table 5 that just goes to under the table 4...". Your meaning is that the Table 5 should be drawn on second page ( followed the end of the Table 4 ), but is it drawn on the top of the Table 4 now? Could you please share further detailed information to clear our confusion on your requirement? Thanks in advance.

Sincerely,
Nina
E-iceblue support team

vozmen
 
Posts: 15
Joined: Thu Mar 22, 2018 7:44 pm

Mon Mar 26, 2018 9:56 am

Hello,

Thanks for your prompt reply.
As the table 4 is too long and it exceed one page, if you still draw the table 5 and table 6 on the first page, there will be the phenomenon as yours. Please use below code to locate the current page and draw the new tables on that page. Hope this can help you. If the issue still happens after trying, please share your full code to help us better investigate it.
Code: Select all
doc.Pages[doc.Pages.Count - 1]

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Mon Mar 26, 2018 2:46 pm

Thank you, but I did try handling it in this way.
Main problem here is that automatically newly created page does not take margins and other settings from the first page nor from the document settings and it seems like not possible to change these settings for already added page.
(only if you add a new page you can specify size and margins)


Nina.Tang wrote:Hello,

Thanks for your prompt reply.
As the table 4 is too long and it exceed one page, if you still draw the table 5 and table 6 on the first page, there will be the phenomenon as yours. Please use below code to locate the current page and draw the new tables on that page. Hope this can help you. If the issue still happens after trying, please share your full code to help us better investigate it.
Code: Select all
doc.Pages[doc.Pages.Count - 1]

Sincerely,
Nina
E-iceblue support team

vozmen
 
Posts: 15
Joined: Thu Mar 22, 2018 7:44 pm

Tue Mar 27, 2018 8:18 am

Hello,

Thanks for your feedback.
Yes, if the first page is an existing page with size and margins, there is no way to change its settings using Spire.Pdf. And you can specify these settings when creating a new page, followed by the automatic created new page will keep the same settings as the page you specified settings. If there is any confusion, welcome to write back.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Tue Mar 27, 2018 10:12 am

Please, check it and if you are sure it keeps same settings then please, provide me with a working example.
In my case it does not keep settings, or at least it does not when you are drawing table on second auto-added page.


Nina.Tang wrote:Hello,

Thanks for your feedback.
Yes, if the first page is an existing page with size and margins, there is no way to change its settings using Spire.Pdf. And you can specify these settings when creating a new page, followed by the automatic created new page will keep the same settings as the page you specified settings. If there is any confusion, welcome to write back.

Sincerely,
Nina
E-iceblue support team

vozmen
 
Posts: 15
Joined: Thu Mar 22, 2018 7:44 pm

Wed Mar 28, 2018 4:07 am

Hi,

I made a sample demo for your kind reference. If there is any question, welcome to get it back to us.
https://www.e-iceblue.com/downloads/attachment/13314Demo.zip

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Wed Mar 28, 2018 9:08 am

Hello,

you example is not really correct, because of it has only one table and there is no underneath tables.

Take a look into my example , please, and help me solve it.
PDFTable.zip


Nina.Tang wrote:Hi,

I made a sample demo for your kind reference. If there is any question, welcome to get it back to us.
https://www.e-iceblue.com/downloads/attachment/13314Demo.zip

Sincerely,
Nina
E-iceblue support team

vozmen
 
Posts: 15
Joined: Thu Mar 22, 2018 7:44 pm

Wed Mar 28, 2018 10:18 am

Hello,

After testing your code, I found a part of second table was wrongly drawn on the top of second page. Sorry the issue is caused by our free version, and we have no plan to update it at present. I tested the case with the latest Spire.PDF Pack(Hot Fix) Version:4.3.4, the result was correct. Also I made some adjustments to your code. Please have a check.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Wed Mar 28, 2018 2:22 pm

In your latest changes, you can see that second auto-added page loose margins at least and thus
second table fills whole page width and you can't change margins.

If you set this - then the bug appears:
//Specify the size and margins for DOC
doc.PageSettings.Size = new SizeF(500.0f, 500.0f);
doc.PageSettings.Margins = margin;

Nina.Tang wrote:Hello,

After testing your code, I found a part of second table was wrongly drawn on the top of second page. Sorry the issue is caused by our free version, and we have no plan to update it at present. I tested the case with the latest Spire.PDF Pack(Hot Fix) Version:4.3.4, the result was correct. Also I made some adjustments to your code. Please have a check.

Sincerely,
Nina
E-iceblue support team

vozmen
 
Posts: 15
Joined: Thu Mar 22, 2018 7:44 pm

Thu Mar 29, 2018 8:04 am

Hello,

Thanks for your feedback.
Are you still using the free version? Our free version indeed has the problem and sorry we have no plan to update it. Please upgrade to the latest commercial version Spire.PDF Pack(Hot Fix) Version:4.3.14 to test again. And you could check my generated result (MyResult.pdf) in previous attachment.
Beside, while using below code to specify settings,
Code: Select all
doc.PageSettings.Size = new SizeF(500.0f, 500.0f);
doc.PageSettings.Margins = margin;

please create the new page with PdfDocument: PdfPageBase page = doc.Pages.Add();

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Mon Apr 02, 2018 9:55 am

Hi,

Greetings from E-iceblue.
Has your issue been fixed with the commercial version?
Thanks in advance for your valuable feedback and time.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.PDF

cron