Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - DrawLine poistioning
  FAQ FAQ  Forum Search   Register Register  Login Login

DrawLine poistioning

 Post Reply Post Reply
Author
Message
rweetch View Drop Down
Senior Member
Senior Member


Joined: 22 Feb 11
Status: Offline
Points: 173
Post Options Post Options   Thanks (0) Thanks(0)   Quote rweetch Quote  Post ReplyReply Direct Link To This Post Topic: DrawLine poistioning
    Posted: 03 May 16 at 7:00PM
When using Drawline with a width of, say, 2mm where are the X and Y positions? are they central to the line or are they set to a corner?

thanks
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 16 at 7:16PM
Hi Weetch,

they are there where you want it ;-)
Where to begin you can set with SetOrigin.
Which metric system you can set with SetMeasurementUnits.
If you want the line at the top of the page you should save two mm if you want to see it ;-)

Cheers,
Ingo

Back to Top
rweetch View Drop Down
Senior Member
Senior Member


Joined: 22 Feb 11
Status: Offline
Points: 173
Post Options Post Options   Thanks (0) Thanks(0)   Quote rweetch Quote  Post ReplyReply Direct Link To This Post Posted: 04 May 16 at 12:18AM
Hi Ingo

what I have is

SetOrigin(1); //top left
SetMeasurementUnits(1); //mm
SetLineWidth(0.7056); //2pts converted to mm
DrawLine(12, 122, 12, 188);
DrawLine(12, 188, 69, 188);

The vertical line is slightly to the left and the bottom line slightly to the right and slightly lower - which means that the lines don't meet correctly at the corner.


Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 04 May 16 at 7:09PM
Hi,

here you can read about:
http://www.debenu.com/docs/pdf_library_reference/DrawLine.php
X means horizontal and Y means vertical.
Start means left and End means right.
Perhaps it's better to use SetMeasurementUnits(0) 'cause DrawLine uses points, too (i think)?
Don't forget the NormalizePage to avoid problems with rotated pages.
If there are still slightly differences try another font.

Cheers,
Ingo

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 04 May 16 at 7:13PM
BTW: 1 point is ...
25,4 mm div 72 = 0,353...

Cheers,
Ingo

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 04 May 16 at 7:16PM
BTW: 1 mm is ...
72 div 25,4 => 2,834...

Cheers,
Ingo

Back to Top
rweetch View Drop Down
Senior Member
Senior Member


Joined: 22 Feb 11
Status: Offline
Points: 173
Post Options Post Options   Thanks (0) Thanks(0)   Quote rweetch Quote  Post ReplyReply Direct Link To This Post Posted: 05 May 16 at 2:44PM
Thanks, I have trawled the function pages and docs.

I have changed the setting of line sizes to points, but need to retain positioning as mm.

The X,Y must be referencing a particular end point of the line but I can't see which. 

if we have  (Origin = Top Left) startX = 1, startY = 1, endX = 10, EndY=1 (straight line for 10mm) say at 2mm wide - does the startX,StartY reference the top left hand corner, the left centre or the bottom left corner? 

If we have 2 lines 
StartX = 1, StartY = 1, EndX = 1, EndY = 10 
StartX = 1, StartY = 10, EndX = 10, EndY = 10 

then I would expect that the bottom of line 1 and the start of line 2 would either overlap completely or line 2 would butt up against line 1. However, line 2 overlaps part of the bottom of line one in both dimensions.

Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 05 May 16 at 5:08PM
If you need super accuracy, you may have to work it out by trial and error.  Set the line thickness temporarily to much wider than you need, draw some lines, and get out a ruler to measure where the coordinate base is on the line.  I suspect it will be quicker than asking here for a definitive answer!

Also remember that the start and end coordinates are double, not integer.  To get absolute accuracy you may need to set Startx to 10.123, not just 10 or 11.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 05 May 16 at 5:16PM
The first line should start at 1 step to right and 1 step top (x1/y1).
It ends at the same horizontal step but 10 step to top.
So it's a vertical line 9 steps long.

The second line should start at 1 step to right and 10 step top (x1/y1).
It ends horizontal 10 steps to right and 10 steps to top
So it's a horizontal line 9 steps long.

So together there should be a 90 degree rectangle.

If there are few points not identical you should try a bit for better results and share your experiences with us.
Thanks in advance ;-)


Cheers,
Ingo

Back to Top
rweetch View Drop Down
Senior Member
Senior Member


Joined: 22 Feb 11
Status: Offline
Points: 173
Post Options Post Options   Thanks (0) Thanks(0)   Quote rweetch Quote  Post ReplyReply Direct Link To This Post Posted: 10 Jun 16 at 6:23PM
In the end I used the draw path methods and just did a bit of fractions of a millimetre adjustments to get it to work.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store