PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Issues with text formatting
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1675
Page 1 of 1

Author:  IanIan [ Mon May 30, 2011 4:50 pm ]
Post subject:  Issues with text formatting

Hi there,

I've got three issues with text formatting when generating Pdfs...

1. Setting a value for LineSpacing isn't having an effect. For example, along with other format properties, I'm doing...

Code:
 para.Format.LineSpacing = 100;


But the lines are the same distance apart as when this code is not there.

2. Is it possible to set the kerning for text?

3. I'm trying describe text fields from an InDesign document in code. The x co-ordinate of a text field translates perfectly in that, if I set a text field to have an x value of 0.0 using MigraDoc, it appears flush against the left side of the page just as it does in InDesign when a text field has an x value of 0.

However, InDesign is pushing the text within a field vertically right to the top where as MigraDoc is adding a small amount of padding. Is it possible to remove this padding so that I can just enter the y values from InDesign without having to work out an offset?

Cheers, Ian.

Author:  Thomas Hoevel [ Tue May 31, 2011 7:39 am ]
Post subject:  Re: Issues with text formatting

Hi!

Re 1:
LineSpacing does work - as defined by LineSpacingRule. If the Rule is Single, Double, or OnePtFive the value of LineSpacing is ignored as those rules have no parameter. Try Exactly or AtLeast.

Re 2:
AFAIK this is not supported with the publically available version (last week my boss made some changes to our current internal build with respect to kerning).

Re 3:
I have no idea what you are talking about.

Author:  IanIan [ Tue May 31, 2011 9:07 am ]
Post subject:  Re: Issues with text formatting

Hi Thomas,

Thanks for your reply.

Quote:
I have no idea what you are talking about.


Let me try again....

Whatever I set the y co-ordinate of a text field in MigraDoc to, the actual text will appear a few pixels below. How can I remove this padding?

Cheers, Ian.

Author:  Thomas Hoevel [ Tue May 31, 2011 9:22 am ]
Post subject:  Re: Issues with text formatting

IanIan wrote:
Whatever I set the y co-ordinate of a text field in MigraDoc to [...]

A code snippet might help. What is a text field?
I know PdfTextField, I know TextFrame.

Author:  IanIan [ Tue May 31, 2011 10:42 am ]
Post subject:  Re: Issues with text formatting

Oh yes... MigraDoc doesn't have a text field object! :wink:

So the code is bit like this and I want the top of the actual text to be the same as the y-position instead of there being a small space there.

Code:
var doc = new Document();
sec = doc.AddSection();

var paragraph = sec.AddParagraph();
var formattedText = paragraph.AddFormattedText("Hello");

var docRenderer = new DocumentRenderer(doc);
docRenderer.PrepareDocument();

// Render the paragraph. You can render tables or shapes the same way.
docRenderer.RenderObject(gfx, XUnit.FromMillimeter(currentTextField.X),
        XUnit.FromMillimeter(currentTextField.Y),
        string.Concat(currentTextField.Width, "mm"), paragraph);

Author:  IanIan [ Wed Jun 01, 2011 5:19 pm ]
Post subject:  Re: Issues with text formatting

In other words, I want to set the vertical alignment to 'top'. :D

Author:  IanIan [ Sat Jun 04, 2011 1:40 pm ]
Post subject:  Re: Issues with text formatting

I spent a few hours trying to find where the top margin is added in the source code. Didn't find it! Any pointers?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/