The one note I'd make is that most 'X vs. Y' threads like this assume that the wizard has just prepared their spells and probably knows what to expect. They also assume that a wizard will have no issues with using all of their highest-level spells in one encounter.

A wizard who has had to prepare for a all eventualities, has fought a couple of level-appropriate encounters and is expecting trouble before he next rests might want to be wary of a ranger.

You might as well compare an un-buffed wizard to a ranger with favoured-enemy (wizard's race / sub-race) and a surprise round from sneaking up on them in their favoured terrain. Add in a suitable combat pet to give flanking, a decent TWF build using leaden blades and power attack, then assume the ranger's high dex wins them initiative even in the first round. The ranger at level 7 will be attacking 8 times before the wizard even stops being flat-footed, for a good chance of at least one critical and maybe a 75% hit rate. So... 3d6 + 21 (assuming +3 for 16 strength, + 4 for power attack each time) and 4d8 + 28 (same bonuses, also assuming the crit was on the longsword) gives an average of 31 + 46 for 77 damage and a dead wizard...

The truth is that Batman always wins; whoever ambushes their foe after preparing their strategy is the winner. It's not about wizard vs. ranger here, just fanboy vs. fanboy.

Wizards can do a lot of damage in a hurry, but then they are spent. A ranger is not quite a 'dance all day' attacker like a fighter or rogue, but a ranger at the end of a hard day of adventuring will murder a wizard in the same situation and barely break a sweat. A ranger without spells is a sub-par fighter, but a wizard reduced to their cantrips is a joke.