Automatically saving plots in batch mode

I am running a macro in batch mode, and I would like to find a way for that macro to generate some histograms that will be automatically saved as image files (like PDFs). Is there any way to do this?

Thanks!

In your macro simply do:

c->Print("file.pdf");

where is a TCanvas