c1.Print("file.ps["); // No actual print, just open file.ps
for (int i=0; i<10; ++i) {
// fill canvas for context i
// ...
c1.Print("file.ps"); // actually print canvas to file
}// end loop
c1.Print("file.ps]"); // No actual print, just close.
This works for PostScript but NOT for PDF: even with “[” TPad::Print() does print. The attached is a sample script which opens, reads and displays a 1D histogram “hpx” from the hsimple.root file produced by running $ROOTSYS/tutorials/hsimple.C, and then print/save the canvas to a PostScript and a PDF file.
That was not what your macro was showing.
To do that you will have to use TPDF etc … but that is more complex than simply using the macro I sent you. If you do not want to print anything why opening a PDF file ? and then if you want to cumulate pictures into the same file simply use the macro I sent you.
Sorry to make you confuse, but I’ve just tried to show that the opening angle bracket character doesn’t work as I expected (it DOES actual printing) for pdf files.
[quote=“couet”]
To do that you will have to use TPDF etc … but that is more complex than simply using the macro I sent you.[/quote]
I see. I’ll consult it.
[quote=“couet”]
If you do not want to print anything why opening a PDF file ? and then if you want to cumulate pictures into the same file simply use the macro I sent you.[/quote]
As in my previous post I sometimes do not want to print anything before doing something and just want to open an output file; main reason is that actual printing is done in loops that follow the opening.