Font em Width & Spacing

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for .NET (v4)  /  Font em Width & Spacing

DynamicPDF Generator for .NET (v4) Forum

 Aug 10 2015 12:47 PM
Hi,

I have a situation where I need to put in a fixed amount of space between words on occasion. For table of contents and such like this:

Chapter 1                            12
Chapter 23                           39

Any suggestions how to do this with any granularity? The space could be measured in inches, picas, millimeters, ems, etc, so it needs to be precise.

I've thought of trying to insert obscure unicode spacing characters according to this site: https://www.cs.tut.fi/~jkorpela/chars/spaces.html, but figured I ask here first before beating my head against the wall any more than I already have.

PS I'd like to avoid tracking X position and overlapping/fragmenting TextAreas if possible. But if that's the only way, then...

Thanks,
Aaron
 Aug 11 2015 12:31 PM
Posted by a ceTe Software moderator
Hello Aaron,

You can set the spacing between words using empty space and add it to the PDF using  TextArea page element of DynamicPDF API. Below is the code sample for it. There is no other way for setting spacing between words in page element.

            Document document = new Document();
            Page page = new Page();
            //Adding text contetns to the TextArea including white space between words.
            TextArea area = new TextArea("Chapter 1                            12", 0, 10, 500, 30);
            page.Elements.Add(area);
            document.Pages.Add(page);
            document.Draw(@"C:\Temp\MyDocument.pdf");

Also note that you will need to keep track of X ,Y positions accordingly to place the page elements on PDF page without overlapping of the contents.

Thanks,
ceTe Software Support Team.
 Aug 11 2015 4:32 PM
I wish my problem was that easy. Thanks for your help.

All times are US Eastern Standard time. The time now is 2:35 AM.