Fix PDF bug in non-js mode