fix outline rendering

- the original code only sorted by page, not by y position, which led to errors
  in case different levels of outline items occurred on the same page.