i came from MS Office VBA and do my first steps on OO and LO Basic. I got several Problems (missing auto fill on IDE etc.), but learning by doing

I am looking for a Basic Code which allows me to save a DINA4 Sheet to a normal PDF automatically. Usually i use the macro recorder and customize the recorded macro to get my first ideas. but i cannot record macros - do not know why.
Has somebody a code snippet which could help me to save the first sheet of an calc document as pdf?
thx in advance