Measurement of branching fractions for exclusive B decays to charmonium final states