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

Text Alignment Issue

Hi

I''m posting here as Direct Track is showing an application error and I cannot login.

I am trying to justify some text retrieved from a data base using the code below using IPDFGraphicState propsAlign, here is my code for that page:

// Create page 3
pdfDoc.CreatePage();
IPDFPage page3 = pdfDoc.Pages[2];

// Insert text into page 3
System.IO.StreamReader page3File =
new System.IO.StreamReader(Server.MapPath("rtfs_fr/new_page_3.rtf"));
string page3Read = page3File.ReadToEnd();
page3.Graphics.DrawRTFText(new PointF(40, 20), page3Read, (float)550, (float)800);

// Set graphicstate
IPDFGraphicState props1 = pdfDoc.CreateGraphicState();
props1.BreakBehavior = AutoBreakBehavior.MultiLineTextBreak;

IPDFGraphicState propsAlign = pdfDoc.CreateGraphicState();
propsAlign.BorderColors.All = Color.Black;
propsAlign.BorderSize.All = 1;
propsAlign.DrawBorderInside = false;
propsAlign.Padding.All = 10;
propsAlign.TextAlignment = TextAlignment.Justify;
propsAlign.BreakBehavior = AutoBreakBehavior.MultiLineTextBreak;

// Assign array value to variable
string comments0 = arrComments[0];
string statements0 = arrStatements[0];

// Measure size of the statement and insert into page 3
SizeF sizeStatements0 = pdfDoc.Graphics.MeasureString(statements0, pdfFont10, (float)(450), props1);
RectangleF page3Rec1 = new RectangleF(new PointF(40, 110), sizeStatements0);
page3.Graphics.DrawMultiText(page3Rec1, statements0, pdfFont10, props1);

// Measure size of the comment and insert into page 3
SizeF sizeComments0 = pdfDoc.Graphics.MeasureString(comments0, pdfFont10, (float)(450), propsAlign);
RectangleF page3Rec2 = new RectangleF(new PointF(40, page3Rec1.Bottom + 20), sizeComments0);
page3.Graphics.DrawMultiText(page3Rec2, comments0, pdfFont9, propsAlign);


I do get the border, padding etc applied to the rectangle. but unfortunately the Justify setting is not being applied.

Any ideas guys?

Regards,

Lee

8 Replies

DK Dhivya K Syncfusion Team September 29, 2006 01:00 PM UTC

Hi Lee,

I was able to reproduce the issue. It is identified as bug and have been logged a bug report with development team.
We will try to fix this issue as soon as possible.You can track the status of this issue from the following link.

http://www.syncfusion.com/support/issues/pdf/Default.aspx?ToDo=view&questId=2462

Please let me know if you have anyother queries.

Thanks,
Dhivya.


LD Lee Diggins October 3, 2006 07:40 AM UTC

Hi

Thanks for letting me know.

Regards,

Lee


DK Dhivya K Syncfusion Team October 3, 2006 10:35 AM UTC

Hi Lee,

My apologies.Text alignment seem to be working fine.

I tried creating a sample such a way that I retrieve the long text from the database and applied "justify" alignment. It works fine.I was able to see the space getting adjusted as in the case of justify.

Here is a sample for your reference.
TextFlow.zip

Could you please look into the sample and let me know if it works fine.

Sorry for the confusion.

Regards,
Dhivya.


LD Lee Diggins October 10, 2006 01:06 PM UTC

Hi Dhivya

I get the sample to work as expected.

My code will not apply justification, however, it will apply, left, right and center but not justify so it has to be a bug yes?

Regards,

Lee


LD Lee Diggins October 10, 2006 01:06 PM UTC

Hi Dhivya

I get the sample to work as expected.

My code will not apply justification, however, it will apply, left, right and center but not justify so it has to be a bug yes?

Regards,

Lee


LD Lee Diggins October 10, 2006 01:06 PM UTC

Hi Dhivya

I get the sample to work as expected.

My code will not apply justification, however, it will apply, left, right and center but not justify so it has to be a bug yes?

Regards,

Lee


DK Dhivya K Syncfusion Team October 11, 2006 04:54 AM UTC

Hi Lee,

Here is a sample exactly with your code. I was not able to reproduce the issue still.
Sample:
TextAlignment.zip


Can you look into the sample if I have missed something in your code?

Here is a screen shot of the PDF file generated with your code.
Screen shot:http://www.syncfusion.com/Support/user/uploads/TextAlignment_2600d164.gif

You can notice that the text inside the rectangle is justified[as the alignment property "propsAlign" is set to "justify].

Can you modify this sample so that I can reproduce the issue? This will help me investigating further on this issue.

Thanks,
Dhivya


AD Administrator Syncfusion Team October 17, 2006 10:49 AM UTC



>Hi Lee,

I was able to reproduce the issue. It is identified as bug and have been logged a bug report with development team.
We will try to fix this issue as soon as possible.You can track the status of this issue from the following link.

http://www.syncfusion.com/support/issues/pdf/Default.aspx?ToDo=view&questId=2462

Please let me know if you have anyother queries.

Thanks,
Dhivya.

Loader.
Live Chat Icon For mobile
Up arrow icon