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

Scaled MultiText and horizontal alignement

Hi,
Found a problem with Graphics.DrawMultiText when both horizontal scaling and horizontal aligmement is used, right and centered text are not draw at corect x position.
Here the code to reproduce the problem:

PDFDocument pdfDoc = new PDFDocument();
IPDFFont pdfFont;

pdfFont = pdfDoc.Fonts.Add (Environment.GetEnvironmentVariable ("systemroot") + @"\Fonts\ARIAL.TTF");
pdfFont.Size = 12.0F;

IPDFPage firstPage = pdfDoc.Pages[0];

IPDFGraphicState DrawProp = pdfDoc.CreateGraphicState ();
RectangleF DimPos = new RectangleF (200, 30, 200, 30);

DrawProp.Scale (0.5F, 0.5F);

DrawProp.TextAlignment = TextAlignment.Right;
firstPage.Graphics.DrawRectangle (DimPos, DrawProp);
firstPage.Graphics.DrawMultiText (DimPos, "Hello World!", pdfFont, DrawProp);

DimPos.Offset (0, 35);
DrawProp.TextAlignment = TextAlignment.Center;
firstPage.Graphics.DrawRectangle (DimPos, DrawProp);
firstPage.Graphics.DrawMultiText (DimPos, "Hello World!", pdfFont, DrawProp);

DimPos.Offset (0, 35);
DrawProp.TextAlignment = TextAlignment.Left;
firstPage.Graphics.DrawRectangle (DimPos, DrawProp);
firstPage.Graphics.DrawMultiText (DimPos, "Hello World!", pdfFont, DrawProp);

DimPos.Height = 60;
DimPos.Offset (0, 35);

DrawProp.TextAlignment = TextAlignment.Right;
firstPage.Graphics.DrawRectangle (DimPos, DrawProp);
firstPage.Graphics.DrawMultiText (DimPos, "Hello World!Test123Test Multi Lines", pdfFont, DrawProp);

DimPos.Offset (0, 65);
DrawProp.TextAlignment = TextAlignment.Center;
firstPage.Graphics.DrawRectangle (DimPos, DrawProp);
firstPage.Graphics.DrawMultiText (DimPos, "Hello World!Test123Test Multi Lines", pdfFont, DrawProp);

DimPos.Offset (0, 65);
DrawProp.TextAlignment = TextAlignment.Left;
firstPage.Graphics.DrawRectangle (DimPos, DrawProp);
firstPage.Graphics.DrawMultiText (DimPos, "Hello World!Test123Test Multi Lines", pdfFont, DrawProp);

pdfDoc.Save("Sample.pdf");

Without Scale, the code work fine.

4 Replies

DK Dhivya K Syncfusion Team January 4, 2007 12:50 PM UTC

Hi Mario,

Thanks again for the code! I was able to reproduce the issue. However, if we scale to the correct position, we can have the proper alignement.

Can you please replace the Scale property with the following values?

DrawProp.Scale (1f,1f);

This will make your sample work. However, I agree that while scaling the coordinates, the text should have proper alignment. I have forwarded this issue to development team.

Regards,
Dhivya.


DK Dhivya K Syncfusion Team January 30, 2007 04:33 AM UTC

Hi Mario,

This issue[defect-3314] is fixed and will be available for our next release. Could you please create direct trac incident if you are interested in patch?

Regards,
Dhivya.


AD Administrator Syncfusion Team February 3, 2007 07:28 AM UTC

Hi Mario,

This issue[defect-3314] is fixed and will be available for our next release.
Could you please open an incident in the direct trac with the forum id as the subject line if you are interested in patch?

http://www.syncfusion.com/Support/DirectTrac/logon.aspx

Thanks,
Balaji U


AD Administrator Syncfusion Team February 3, 2007 07:32 AM UTC

Hi Mario,

This issue[defect-3314] is fixed and will be available for our next release.
Could you please open an incident in the direct trac with the forum id as the subject line if you are interested in patch?

http://www.syncfusion.com/Support/DirectTrac/logon.aspx

Thanks,
Balaji U

Loader.
Live Chat Icon For mobile
Up arrow icon