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 

What are all of the X, Y, width and height measurements in?

 
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
cmgarnett



Joined: 24 May 2007
Posts: 11
Location: Bedford, UK

PostPosted: Thu May 24, 2007 11:14 pm    Post subject: What are all of the X, Y, width and height measurements in? Reply with quote

I'm just starting to use PDFsharp with VB.net and its looks really good. Thank you to everyone who has been working on it.

I've managed to print some strings and a paragraph of text in a rectangle, but I'm struggling with measurements.

What unit of measurement is used to define where drawstring and drawrectangle, etc. should be positioned, and how large they should be?

How about font sizes, are they in the same units?

Is it millimetres, points (72 points to an inch I think) or some other unit.

I am trying to layout a page but I'm having to do quite a lot of guessing rather than using a ruler.
Back to top
View user's profile Send private message
Thomas Hoevel



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

PostPosted: Thu May 31, 2007 3:46 pm    Post subject: Reply with quote

Unit generally is Points.
You can use the XUnit class to make things simple:
Code:

XRect recA4 = new XRect(0, 0,
  XUnit.FromPoint(595),
  XUnit.FromPoint(842));

XRect recA4fromCentimeter = new XRect(0, 0,
  XUnit.FromCentimeter(21.0224),
  XUnit.FromCentimeter(29.7302));

You can also use XUnit.FromInch or XUnit.FromMillimeter.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
cmgarnett



Joined: 24 May 2007
Posts: 11
Location: Bedford, UK

PostPosted: Thu May 31, 2007 3:53 pm    Post subject: Reply with quote

Thanks for that. I'll try it out and then add it to the documentation.

Ragrds.

Chris
Back to top
View user's profile Send private message
cmgarnett



Joined: 24 May 2007
Posts: 11
Location: Bedford, UK

PostPosted: Mon Jun 04, 2007 10:46 am    Post subject: Reply with quote

When I try the code that you suggest, I get a 13mm margin on the left, rather than an 11mm margin, and a 29mm from the top rather than 23mm!

Dim dSideMargin As Double = XUnit.FromMillimeter(11)
oXGraphics.DrawString("My test string", oXFont_H, XBrushes.Black, _
New XRect(dSideMargin, XUnit.FromMillimeter(23), oPDFPage.Width.Point - (dSideMargin * 2), oXFont_H.Height), XStringFormat.TopLeft)

Have I misunderstood something?
Back to top
View user's profile Send private message
Thomas Hoevel



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

PostPosted: Mon Jun 04, 2007 11:13 am    Post subject: Reply with quote

AFAIK this is a bug - in PDFsharp or in Windows.
The margins of the printer add to the margins you set.

See this thread for a solution.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
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