optimize pdf layout