|
PDFsharp - moved to http://forum.pdfsharp.net/ Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
|
Important Notice:
We regret to inform you that our free phpBB forum hosting service will be discontinued by the end of June 30, 2024.
If you wish to migrate to our paid hosting service, please contact billing@hostonnet.com.
View previous topic :: View next topic |
Author |
Message |
choreson
Joined: 17 Jul 2007 Posts: 12
|
Posted: Thu Jun 19, 2008 1:09 pm Post subject: How to center an image on a page? |
|
|
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. |
|
Back to top |
|
|
Emanuel
Joined: 21 Jul 2008 Posts: 4
|
Posted: Mon Jul 21, 2008 4:34 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
Thomas Hoevel
Joined: 16 Oct 2006 Posts: 387 Location: Cologne, Germany
|
Posted: Tue Jul 22, 2008 7:29 am Post subject: Re: How to center an image on a page? |
|
|
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 |
|
Back to top |
|
|
|
|
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 vote in polls in this forum
|
|