PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Oct 19, 2024 10:02 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Aug 07, 2014 3:59 am 
Offline

Joined: Wed Mar 06, 2013 3:53 pm
Posts: 22
So here is what I have. I have a heading that I want to center, but I want the page # to print right aligned.

So my page heading would look something like this (| represents paper border)

| xxxxxxxxxxxxxxx Page 1|

I haven't been able to figure out how to both center the heading, and right align the 'AddPageField'

I'm going something like this

myParagraph.AddFormattedText("This is my page heading", "Center"); (obviously 'center' is paragraph.align center
myParagraph.AddFormattedText("Page ", "PageNumber"); (pagenumber is a paragraph.align right)
myParagraph.AddPageField();


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 07, 2014 8:49 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
Add two TabStops: one in the middle (center aligned) and one at the right edge (right aligned).
This works fine if the text in the middle is not too long.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 07, 2014 6:37 pm 
Offline

Joined: Wed Mar 06, 2013 3:53 pm
Posts: 22
Oh gosh. That is such a simple solution that I didn't even consider it. I use tab stops all the time, but didn't even consider that.

Thanks!


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 59 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