TCanvas in batch mode within app

I have been working on a simple interface that uses the ROOT GUI classes and draws control plots and I am stuck with a small problem. There is a method within the interface that should draw on a canvas and save it (it can be either a canvas created within the method or private to the method’s class), but I do not want that particular canvas to be shown at all - everything should happen in memory only. Other embedded canvases exist in the app and are open at the same time, so I concluded that maybe I could use the TCanvas::SetBatch function for that particular canvas.

However, prior to creation I cannot call ->SetBatch for that canvas, of course, as the object does not exist yet, and if I do it after creation then an undesired window for that canvas already exists but is kept blank as everthing is, I think, done in memory only. However, if I do it that way it seems I get a segfault when objects are being drawn into that canvas.

So, how can I create a memory-only canvas without it being attributed to a window, draw in it, save it as a file and delete it again without the GUI user taking notice? I think this is related to the SetBatch, but I am afraid I could not find further documentation about that and haven’t managed to get it to work properly on a trial-an-error basis so far yet. Thanks in advance!

When you are not in batch mode (set with gROOT->SetBatch()), a canvas creation generates a window.
Is the graphics you would like to produce in batch meant to be a PS or PDF file ?