You won't believe how very easy this is, but there is a word of warning.
Not all flowers are edible, so you need to do some research if you want to do something unusual. However, the good news is that unsprayed primroses and primulas are perfectly safe to eat (as are rose petals).
This recipe is from Delia's Cakes.
All you do is lightly beat an egg white with a teaspoon of water.
Using a small soft brush lightly coat the surface of the petals, then sprinkle generously with caster sugar. Then leave them on a cake liner or some baking parchment to dry out completely (at least overnight). After that store them in an airtight container.