PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Jul 09, 2024 9:31 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Mon May 30, 2011 4:50 pm 
Offline

Joined: Mon May 30, 2011 3:32 pm
Posts: 9
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.


Top
 Profile  
Reply with quote  
PostPosted: Tue May 31, 2011 7:39 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue May 31, 2011 9:07 am 
Offline

Joined: Mon May 30, 2011 3:32 pm
Posts: 9
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.


Top
 Profile  
Reply with quote  
PostPosted: Tue May 31, 2011 9:22 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue May 31, 2011 10:42 am 
Offline

Joined: Mon May 30, 2011 3:32 pm
Posts: 9
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);


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 01, 2011 5:19 pm 
Offline

Joined: Mon May 30, 2011 3:32 pm
Posts: 9
In other words, I want to set the vertical alignment to 'top'. :D


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 04, 2011 1:40 pm 
Offline

Joined: Mon May 30, 2011 3:32 pm
Posts: 9
I spent a few hours trying to find where the top margin is added in the source code. Didn't find it! Any pointers?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group