PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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.
Center an Image on Page

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
polygonwindow



Joined: 21 Apr 2008
Posts: 4

PostPosted: Mon Apr 21, 2008 7:32 am    Post subject: Center an Image on Page Reply with quote

Hello Everybody,

I'm having trouble centering a loaded jpg-file (72dpi) on the DIN A4 page. I mean i could calculate its position but there's the issue with page size in Point s or millimeters and Image size in pixels. Is there a way to put it in a Table or similar and center it vertically and horizontally?

Another thing: am I just a bit dumb or isn't there really a doumentaion/reference on pdfsharp? i checked all the links like sourceforge, pdfsharp.org and the wiki.

Thx for any hints.

Cheers,
Poly
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Mon Apr 21, 2008 8:04 am    Post subject: Reply with quote

Hello, Poly,

Calculating the image position should be no problem since XUnit can do all the conversions.
This also allows you to resize images (make 'em smaller, maybe even make 'em larger).

Documentation is a weak point. But the samples give you an idea how PDFsharp works in general, and Intellisence will show you the available methods.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
polygonwindow



Joined: 21 Apr 2008
Posts: 4

PostPosted: Mon Apr 21, 2008 8:45 am    Post subject: Reply with quote

Hello Thomas,

Thanks a lot for the quick reply. I thought XUnit could be the way but didn't know it can handle pixels as well, i'll give it a try.

A nice reference would be really nice, the only thing i'm missing - but i can imagine how much work that is.

By the way: You guys are doing a really great job on PDFsharp - it's a really cool piece of software and works really nice and fast so far.

Thanks,
poly
Back to top
View user's profile Send private message
polygonwindow



Joined: 21 Apr 2008
Posts: 4

PostPosted: Mon Apr 21, 2008 4:28 pm    Post subject: Reply with quote

Hello again,

sorry, i can't figure out how i can get the pixel-to-point-conversion using XUnit.

Can someone give me a hint?

XUnit has only .fromCentimeter .fromMillimeter .fromInch .fromPoint

Thanks for any help,
Poly
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Tue Apr 22, 2008 7:52 am    Post subject: Reply with quote

Hello!
polygonwindow wrote:
sorry, i can't figure out how i can get the pixel-to-point-conversion using XUnit.

Sorry, my mistake (will be included in PDFsharp 1.1).

Here's how to get it done with PDFsharp 1.0:
Quote:
XImage img = XImage.FromFile(filename);
Unit height = Unit.FromInch(img.PixelHeight / img.VerticalResolution);
Unit width = Unit.FromInch(img.PixelWidth / img.HorizontalResolution);

_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
polygonwindow



Joined: 21 Apr 2008
Posts: 4

PostPosted: Tue Apr 22, 2008 12:15 pm    Post subject: Reply with quote

Ahh super! this will work..

Thanks a lot for the help.

Poly
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com