We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Draw table beyond the page or end of the client area

Hi there,

I've set margins and all, have drawn my little table and then do this

pdfTable.Draw(result.Page, new PointF(20, result.Bounds.Bottom + 30), format);

But unfortunatly, I try to draw this beyond the area where I'm allowed to draw and get the error "Can't draw table, because there is not enough space for it."

So how do I solve this? Try-Catch and solve the problem on a new page or anything? Or can this automatically be done?

Thanks,
Dennis


13 Replies

SS Sri Subhashini M Syncfusion Team July 22, 2008 03:54 AM UTC

Hi Dennis,

Thank you for your interest in Syncfusion PDF.

'Cant draw exception' has been thrown in PdfLightTable

The issue mentioned here is suspected to be a defect and we have sent this to our development team for more analysis. We will update you once we get back from them.

Please let me know if you need any further assistance.

Regards,
Suba




DV Dennis van der Stelt July 23, 2008 07:29 AM UTC

Well, this needs to go into production august 1 so if you guys fix this for us makes us decide if we buy the product or not!

I've got it working for 90% or so with an open source product. But I don't like open source because lack of support. So SyncFusion looked like it would work, but apparently I found two bugs. I can live with the first but this really has to be fixed, or an alternative has to be presented.

It's taking me huge amounts of time to produce nice looking PDFs with both this library as the open source library. Can't believe it's that hard.

I also think there need to be a lot more examples. I really don't care about drawing elipses and everything, but I do care A LOT about drawing tables and producing documents that span more than 1 page. But there aren't too many examples on that.



SS Sri Subhashini M Syncfusion Team July 23, 2008 11:35 AM UTC

Hi Dennis,

Sorry for the inconvenience caused.

We have noticed our devlopement team already. They are working with the issue with high priority. We will update you once I get back with them.

If possible, could you please update me the sample regarding the issue.

Regards,
Suba




DV Dennis van der Stelt July 25, 2008 07:12 AM UTC

It's actually quite easy what I did

page.Section.PageSettings.Margins.Bottom = 20;
result = pdfTable.Draw(page, new PointF(20, startDepth), format);
result = pdfTable2.Draw(result.Page, new PointF(20, result.Bounds.Bottom + 30), format);

pdfTable2 is drawn at the bottom of pdfTable1, but I add an additional 30 pixels. Because I set the bottom margin to 20, at some occasions the library is trying to draw in that 20 pixels margin and I get the exception. Or at least I think it's in that 20 pixels space.

It *MIGHT* have something to do with having no top margin, but I might be wrong there. You'll have to test it.



AD Administrator Syncfusion Team July 25, 2008 01:17 PM UTC

Hi Dennis,

I deeply regret for the inconvenience caused.

Could you please try the below sample.

http://www.syncfusion.com/support/user/uploads/Sample_564f8cd5.zip

Please let me know if you need any further details.

Regards,
Suba




DV Dennis van der Stelt July 28, 2008 06:00 AM UTC

Hi,

It works... But try setting the bottom margin to 600.

The page has a height of 842
The end of the first table is at 198

The space between the two tables should be 30, that's why we do result.Bounds.Bottom + 30 in the code.

Now imagine the row-height is about 15 or so.

198 + 30 + 15 = 243

The first row of the second table is drawn from height 228 to 242 (15 pixels heigh)
So when we can't draw the table there because of the margin, it throws the error.

Page height 842 - 243 = 599. So set the margin in line 179 of your example to 599 (or 600 to have a nice round number ;) and the drawing of the 2nd table will throw an exception.



DV Dennis van der Stelt July 28, 2008 06:05 AM UTC

This would work by the way, but I think this should be handled gracefully by the Syncfusion PDF library

try
{
result = table2.Draw(result.Page, new PointF(20, result.Bounds.Bottom + 30), format);
}
catch
{
page = doc.Pages.Add();
result = table2.Draw(page, new PointF(20, 20), format);
}



SS Sri Subhashini M Syncfusion Team July 28, 2008 12:30 PM UTC

Hi Dennis,

I regret for the inconvenience caused.

We have logged this as a issue and our development team is currently working on this. We will get back with you once the issue has been fixed.

Thank you for your patience.

Regards,
Suba




AD Administrator Syncfusion Team March 17, 2009 12:34 PM UTC

Even I am facing a similar issue. Has there been a fix to this (also mention the build number if there is one)



GM Geetha M Syncfusion Team March 18, 2009 12:17 PM UTC

Hi Ram,

Thank you for your interest in Syncfusion products.

I have forwarded your request to our development team and will update you once I hear back from them.

Regards,
Geetha



GM Geetha M Syncfusion Team March 19, 2009 12:55 PM UTC

Hi Ram,

Thank you for your patience.

The problem of Can't Draw exception will be corrected in PdfGrid table which will be available in our next public release. Meanwhile, could you please check if the below workaround suits you?

http://files.syncfusion.com/samples/Pdf.Windows/PdfLightTable/main.htm

Regards,
Geetha



BS Barry Shulam March 5, 2010 08:31 PM UTC

I am seeing the same error in 2010 vol1 8.103.0.30 which is the latest version.

Has this not fixed almost a year later?
Its holding up a new report.


PJ Pravin Joshua D Syncfusion Team March 18, 2010 06:27 AM UTC

Hi Barry,

Thank you for your interest in Syncfusion products.

This is not an bug with our library. If we try to draw more number of columns on a particular page which does not have enough room available to accomodate all the columns, then this exception will be thrown. We need to workaround this by taking advantage of our PdfLightTableLayouter class and handle the horizontal overflow of columns to subsequent pages.

If you are able to reproduce the issue again, please report the issue with your sample through Direct Trac Developer Support Systemhttps://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents because you can take the advantage of the expertise of a dedicated support engineer and a guaranteed response time and we hope you will take advantage of this system as well. If you have already reported, please ignore this.

Please let us know if you have any other questions.

Regards,
Pravin.


Loader.
Live Chat Icon For mobile
Up arrow icon