Looking at the code you have inside the loop, $y is being set to 760 for all lines.
In reply to Re: Print to PDF by poj in thread Print to PDF by PilotinControl