PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 11:05 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
PostPosted: Mon Mar 03, 2014 2:52 pm 
Offline

Joined: Wed Feb 26, 2014 3:48 pm
Posts: 8
Hello;

Using PDFsharp GDI+ with VS2010. Not sure of the PDFsharp version but the Copyright is 2005-2009.

I'm trying to get a better handle on coordinates when drawing paths and lines. My first question is how are these numbers measured? That is, what are these doubles I'm putting into the following code? mm? pixels? in-ft?

From Sample Code:

Code:

 XPen pen = new XPen(XColors.Black, 0.0);

            XGraphicsPath path = new XGraphicsPath();

            // Winding fill mode
            path = new XGraphicsPath();
            path.FillMode = XFillMode.Winding;
            path.AddLine([b][u]5.0, 25.0, 30.0, 12.0[/u][/b]);
           
            // First two Numbers = bottom left
            // Second two Numbers = top left

            //path.AddBeziers(new XPoint[]{new XPoint(130, 40), new XPoint(150, 0), new XPoint(160, 20), new XPoint(180, 40),
                                   //new XPoint(200, 60), new XPoint(220, 60), new XPoint(240, 40)});
            path.AddLine([b][u]35.0, 20.0, 5.0, 45.0[/u][/b]);

            // First two numbers = Top Right
            // Second two numbers = btm right

            path.CloseFigure();
            //path.AddEllipse(160, 80, 50, 40);
            gfx.DrawPath(pen, XBrushes.Silver, path);



As you can see I've taken out the Beziers and Ellipse. I'm trying to create a polygon. I understand (I think) that the CloseFigure() is taking the two (+/-) vertical lines and connecting the dots.

My second question is, I have a polygon with up to 12 points. Basically I'm creating block letters from scratch. There will be two letters nested together and they are block, not curved at all. How many of these AddLine(x,x,x,x); can I add to this XGraphicsPath();? I can make 4 points work, but sure would like to have more available to me.

My last question is where is 0.0,0.0 relative to the paperspace?

I've looked on the forum search and the new site for more details. Any direction you could provide would be deeply appreciated.

Thank You. Frank Pytel


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 03, 2014 8:45 pm 
Offline

Joined: Wed Feb 26, 2014 3:48 pm
Posts: 8
It's more than likely me, but I figured this out. For any other newbs with the same question.

Point/Points is/are a part of C# and not a part of PDFsharp (I think. Sort of?!?)

Anyway, the first point in the coordinates or array is the first point on the paper and as near as I can tell they travel clockwise from there. Or at least that's how I had to look at it.

What I ended up doing was to just create a line with one (Pixel?!? Still don't understand the points as you have to put in 1 more as shown below. Not sure what 1 is)

Code:

// Creates a RED point. Coordinate 1 & 2 (x(Left to Right),y(Top Down))

            //XPen pen2 = new XPen(XColors.Red, 0.25);
            //XPoint[] points =
            //  new XPoint[] { new XPoint(18.0, 24.0), new XPoint(18.0, 25.0) };
            //gfx.DrawLines(pen2, points);



The red dot is how I tracked what was going around the paper space. I get one set where I like it and set the second coordinate and the red dot simultaneously. That helped.

Have a Great Day!! Newbs Rule!! :twisted: :twisted: :twisted:


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 04, 2014 9:47 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
PDF is a vector format and has no pixels - a line of length 0 will not show.
Co-ordinates are points (1 point = 1/72 inch).

See also:
viewtopic.php?p=2979#p2979
viewtopic.php?p=5907#p5907

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 04, 2014 10:31 am 
Offline

Joined: Wed Feb 26, 2014 3:48 pm
Posts: 8
Awesome. Thank You Thomas. That will help immensely

Frank Pytel


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