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
close icon

Set or increase PdfLayoutResult bounds (Y value)

Hi,

Is there a way to set the bounds manually?

for example:

PdfLayoutResult result = new PdfLayoutResult();
result.Bounds.Y = result.Bounds.Y + 100;

The mouse tooltip in Visual Studio says Bounds.Y can be Get or Set with float value. But if I do the above, it'll say result.Bounds is read-only.

I'm trying to create a 'white-space" below DrawRectangle. So the next element can reference PdfLayoutResult.Bounds as its starting point.

Thanks

-Eric

3 Replies

KC Karthikeyan Chandrasekar Syncfusion Team June 13, 2013 04:48 AM UTC

Hi Eric,

Thank you for your interest in Syncfusion Products.

 

Bound is a variable of type “System.Drawing.RectangleF” so the value Bounds.Y is shown that it can be get and set.

But the Property “Bounds” itself is  Read-only you can see it by using Mouse tooltip.

 

Any way to get the white space after the rectangle, you may increase the value of the starting point of the second element instead you increase the bounds of the first drawn element.

Please refer the sample code snippet below.

PdfLayoutResult result = element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));

g.DrawRectangle(brush, new RectangleF(0, result.Bounds.Bottom + 100, g.ClientSize.Width, 30));  //Leaves 100 points space between last drawn element and new rectangle

           

 

Please let us know if you have any concern.

 

 

Thanks,

Karthikeyan.C

 



EY Eric Yang June 13, 2013 04:18 PM UTC

Hi Karthikeyan,
 
Thanks for the reply. However, I'm looking for variable height of rectangleF, not a hardcoded 100 gap.
 
Please see layout I attached with message.
 
I'm trying to achieve two things.
1. Draw a rectangle with a border to enclose two tables that have variable height
2. And find out the starting point of my next element "some texts start here..."
 
I tried PDFGrid object which returns GridLayoutResult with bottom bounds. So maybe I can try to work my way around that. But PDFGrid doesn't allow me to hide the table header, so I'm back in using PDFLightTable.
 
Thanks
 
-Eric


pdf_layout_35ed79cd.rar


KC Karthikeyan Chandrasekar Syncfusion Team June 18, 2013 04:51 AM UTC

Hi Eric,

Thank you for your update.

 

I have attached a sample solution which satisfies your requirements.

Please refer the sample, and let me know if you have any concern.

DrawTemplate.zip

 

 

Thanks,

Karthikeyan.C

 


Loader.
Live Chat Icon For mobile
Up arrow icon