If you don't have any posts in yet, it's a good idea to install them first before measuring up for a gate because you may not know exactly how far apart they will be. See the Gate Posts Page for more information on what is suitable for swing gates.
Measure as per the diagram below considering any slope, dips or rises that may exist across the driveway, it may not look like there is any but there usually is so it pays to check. A Laser level is very handy for getting a level line even a low cost one from a hardware stores will do, otherwise a level on a straight edge (length of steel box section) or a level string line will also do.
If you print this page out you can write the measurements on the diagram below for clarity.
If the driveway drops more than 50mm you may need to consider making the bottom of the gate raked so it follows the contour of the driveway. If the top of the gate posts are at different heights you should take the lowest post and use that or if there is fencing leading up to the gate that is also on a slope then you may consider having both the top and bottom rails raked.
If the driveway slopes up from the road or the area the gate opens into slopes up or down from the driveway see our page on Sliding Gate Rolling Hardware for more information.