Differences between TPDF and TPostScript

Dear ROOTers,
some of you could please explain me why TPDF behaves differently from TPostScript? For example using the following macro, but using TPostScript, I correctly obtain 2 pages (the first one with h1 and h2 and the second one with h3 and h4), whereas using TPDF I get 3 pages: the first one empty, the second one with h1 and h2 and the third one with only h4!

TCanvas *myc = new TCanvas(“myc”,"",1);
myc->Divide(1,2);
TPDF *pdf = new TPDF(“prova.pdf”,111);
pdf->NewPage();
myc->cd(1);
h1->Draw("");
myc->cd(2);
h2->Draw("");
myc->Update();
pdf->NewPage();
myc->cd(1);
h3->Draw("");
myc->cd(2);
h4->Draw("");
myc->Update();
pdf->Close();

even if I try to produce a PDF file containing a single histo to avoid to have an empty initial page it seems that I have to use the “same” option:

TPDF *pdf = new TPDF(“prova.pdf”,111);
h1->Draw(“same”);
pdf->Close();

what is going wrong?

many thanks!

Pierpaolo

I will look. But to create a multi-pages file I would recomend you to use something like:

{

TFile f("hsimple.root","READ");

c1 = new TCanvas("c1","sub data",200,10,700,500);

c1.Divide(2,2);

c1.cd(1);
hpx->Draw();

c1.cd(2);
hpx->Draw();

c1.cd(3);
hpx->Draw();

c1.cd(4);
hpx->Draw();
c1->Print("h1.ps(","ps");

c1.Divide(1,1);
c1.cd(0);
hpx->Draw();
c1->Print("h1.ps)","ps");

} 

if you change “ps” to “pdf” it’s working the same way.

you are completely right. But in that case how can I decide about orientation (portrait or landscape)? It seems that

c1->Print(“h1.pdf(”,“Portrait”);

is not working because by default it creates a postscript file.

the aspect ratio of the canvas defines that automatically.

Ok many thaks, I’ll do it in that way! In any case TPDF could have some problems…