Set header of a PostScript file

I just thought this could be useful for others…

I usually print many .ps files created by the ROOT scripts and sometimes I forget when I have created a particular plot.
Once I thought that it would be a good idea to place a small label with time and date in the corner of each picture. For example, one can do it by the following code in ~/.rootlogon.C

TDatime *dt4headerps = new TDatime();
gStyle->SetHeaderPS(Form("gsave 0 -20 t 0 r 0 0 m /Helvetica findfont 25 sf 0 0 m ( %s %s ) show gr",
                    dt4headerps->AsString(),
                    gSystem->GetUserInfo(gSystem->GetUid())->fUser.Data()));
delete dt4headerps; dt4headerps = 0;

Whenever you create a .ps file by the ROOT script you will see a label in the left bottom corner of the first sheet of your file.

That’s nice. Note also that gStyle->SetOptDate(1) does something very similar.

That is really useful! That would also be great to have a method which prints the script name somewhere in the corner of the canvas.