I've never tried this but it should work. It won't gurantee all legs are the same length but it should verify all the ends are in a plane and your table won't wobble on a flat floor. It does rely on your table being rigid. It also assumes your legs are pretty close in length to begin with.
Place your table upside down on your workbench. Maybe shim any corners not in contact with the bench (unimportant if your table is really rigid). Fasten a piece of non-stretchy string between diagonal corners such that it makes contact with the bottom of each leg and is taught as possible without pulling the legs together. Call these legs 1 and 3. Now fasten another string to one of the other legs, say 2, and pull it taught to leg 4. If, as you bring the second string down just to the point of contact with leg 4, the string just touches the first string, your leg ends are all in a plane.
If, once the string makes contact with leg 4, the second string is above the first string (not making contact), you need to trim leg 2 or leg 4. Measure and choose the longer leg if there is one.
The third possibility is that the second string makes contact with the first string before making contact with leg 4. In this case, start over but with the first string between legs 2 and 4.
This relies on the fact that two intersecting straight lines define a plane. One caution is that the two strings should have similar tension.
Edit: My answer was directed at trimming legs of an already assembled table but it could be equally applied to legs clamped onto the rails previous to fastening.
Edit 2: If you need do this frequently, you could substitute two straight edges for the string. One of the straight edges, say 1 x 4 pine, would be cut in two in the center. Spread the pieces apart and splice a short piece along the bottom such that it maintains the straight edge.
Edit 3: As @aaron points out, the string method is made more precise by shimming the string on legs 2 and 4 by a string thickness and gauging levelness when the strings barely touch.