added automatic pdf creation (still buggy)