PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon Aug 19, 2019 12:25 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Postioning text
PostPosted: Thu May 09, 2019 5:15 pm 
Offline

Joined: Fri May 03, 2019 10:10 pm
Posts: 21
I am investigating using this in a project where I need to position the text at a precise position on the page.
I also need to change the page orientation how do you do that?
In the "Hello World" example you have the following statement:
New XRect(0, 0, page.Width.Point, page.Height.Point), XStringFormats.Center
I asume that 0, 0 is the position of the rectangle, so does that mean that 0, 0 is the centre of the page?
I also see that all the commands begin with X, so have you got a list of all these Class commands and their syntax?


Top
 Profile  
Reply with quote  
 Post subject: Re: Postioning text
PostPosted: Thu May 09, 2019 8:18 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 479
Location: CCAA
Rocky48 wrote:
I asume that 0, 0 is the position of the rectangle, so does that mean that 0, 0 is the centre of the page?
No. I think (0, 0) is the top-left corner of the page.
Rocky48 wrote:
I also see that all the commands begin with X, so have you got a list of all these Class commands and their syntax?
The Graphics class from Microsoft and others (Rect, Brush, Pen, ...) are sealed. The extra X indicates classes that work with PDF and with a Graphics object when needed.
The documentation from the source code can be found here:
http://www.nudoq.org/#!/Packages/PDFsha ... harp/XRect

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
 Post subject: Re: Postioning text
PostPosted: Fri May 10, 2019 12:28 pm 
Offline

Joined: Fri May 03, 2019 10:10 pm
Posts: 21
If the top left-hand corner is 0,0 why is the example printed in the centre of the page? I can't see any other commands that state any position in the pdfsharp "Hello World" example (VB VERSION)?

If the 0,0 are the top left of the page, then are the properties page.width & page.height the size of the page, so as to define the rectangle of the page size and the center property prints the text in the middle of the page. Am I right in assuming this?
If so where does the code get the page size?
How do you define the page?
I am not very conversant with C#,can I code this in VB?


Top
 Profile  
Reply with quote  
 Post subject: Re: Postioning text
PostPosted: Sun May 12, 2019 12:53 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 479
Location: CCAA
Rocky48 wrote:
I am not very conversant with C#,can I code this in VB?
Yes.

The DrawString method has a parameter that specifies the alignment. The XRect is the complete page. Page sizes is taken from properties of the page.
Typically you will use a smaller rectangle and a different alignment.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 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