modify pdf drawing function