slightly changed pdf creation