Vertical text has missing spaces...

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for .NET (v4)  /  Re: Vertical text has missing spaces...

DynamicPDF Generator for .NET (v4) Forum

 Mar 02 2012 10:53 AM
When generating a label as vertical text (angle 90), it works great unless my text string has spaces in it. If so, the text appears to compress out those spaces when displaying. Thus, the word 'Alaska' shows fine, the string 'District of Columbia' is compressed to 'DistrictofColumbia' when printed vertically on the produced page. I am producing a rectangle behind the vertial text with the exact same width/height as the text. When 'Alaska' prints, it fits perfectly in the rectangle. When 'District of Columbia' prints, there are gaps at the top and bottom - thus the spaces are compressed out and it is centered vertically in the space (the intent). My major label settings are as follows:

font = courier
width = fontsize (9pt)
height is string len * line height (asc(c9)-dec(c9)+linegap(c9))
textalign = center, verticalalign=center
angle = 90

Is there a way to maintain the spaces such that the vertical text display will be accurate?

Any help would be greatly appreciated. Thank you for your time.
Posted by a ceTe Software moderator
Hello,

We have not see this kind of behavior while using our DynamicPDF Generator for .NET product. Please send over the following details to our support team at: support@cete.com  so that they can look into it further.

1.        Output PDF document.
2.        Sample code which you are using.
3.        Exact version and build number of the DynamicPDF DLL file.

Thanks,
ceTe Software Support Team.
The requested data has just been sent to 'support@cete.com' - any additional insight would be greatly appreciated. Thank you.
Posted by a ceTe Software moderator
Hello,

Thanks for sending the requested information to our support team. We did some testing on our end and found that when the text having space at the start of the string is moved to next line then the space is ignored. This is desired behavior with our DynamicPDF Generator for .NET API.

You can achieve your requirement by adding each character of the string individually using TextArea page element and setting the correct Y position to it. Below is the sample code for it.

            Document document = new Document();
            Page page = new Page();
            document.Pages.Add(page);
            string text = "District of Columbia";
            float y = 100;
            foreach (char ch in text.ToCharArray())
            {
                TextArea area = new TextArea(ch.ToString(), 100, y, 10, 20);
                Font font = Font.Courier;
                float widht = font.GetTextWidth(ch.ToString(), 9);
                area.Width = widht;
                area.Font = font;
                area.FontSize = 9;
                area.Height = area.GetRequiredHeight();
                area.VAlign = VAlign.Center;
                area.Align = TextAlign.Center;
                page.Elements.Add(area);
                y = area.Y + area.Height;

            }
            document.Draw(@"C:\MyDocument.pdf");

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 1:17 AM.