Error detected. PDF file generation aborted: Trying to access array offset on value of type int