PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Apr 24, 2024 12:10 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 Jun 19, 2008 1:09 pm 
Offline

Joined: Tue Jul 17, 2007 7:12 pm
Posts: 12
I searched this forum, but could not find a post related to this problem. I am adding an image to the top of my page as the banner like this:

section.AddImage(thePathToTheImageFile);

But, this will left-align the image. I would like to center it. I tried peeking through the intellisense, but could not see any property or method that does this.

I think this should be fairly easy, but could not figure out how. Thanks for your hint.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jul 21, 2008 4:34 pm 
Offline

Joined: Mon Jul 21, 2008 4:20 pm
Posts: 4
No idea if this works here but in some other PDF creation tools I simply inserted the image in a table, might be a workaround bot worked for me.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 22, 2008 7:29 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
choreson wrote:
section.AddImage(thePathToTheImageFile);
But, this will left-align the image. I would like to center it. I tried peeking through the intellisense, but could not see any property or method that does this.


Here's the trick:
Code:
Image img = section.AddImage("../../SomeImage.png");
img.Left = ShapePosition.Center;

The name Left is misleading - you specify the horizontal position (normally for the left edge), but you can also specify center or right alignment.

_________________
Regards
Thomas Hoevel
PDFsharp Team


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 210 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