TPostScript, empty pages are created in between real pages

From: Nevzat Guler <nguler_at_jlab.org>
Date: Sun, 21 May 2006 21:40:29 -0400 (EDT)

	Hello,
	I have a program that creates a postscript file. But whenever I do
NewPage, some empty pages are created in between the real pages. So i have extra empty pages. It is not problem only it makes the file look liitle bit uglier. I pasted the part of the program that I create the postscript file below. It is rather long but basically it is a lot of Draw and Set commands. I played with the
places of NewPage() commands, and also c1->Update() and c1->Modified() commands... Nothing helped. I assume i am doing some very basic mistake here. I appreciate your help. Thank you.

                                Nevzat Guler

//**********************************************************************************************
//*******************************************************************************************

	TF1 *myfit = new TF1("myfit","gaus");
	myfit->SetLineColor(kRed);

   	TCanvas *c1 = new TCanvas("c1","c1",0,0,900,900);
  	c1->SetGrid();
	gStyle->SetStatH(0.15);
	gStyle->SetOptStat(110011);
	gStyle->SetOptFit();

	TPostScript *ps = new TPostScript("Quality_PLOTS.ps",111);
	ps->NewPage();

	fcg_asym->SetLabelSize(0.02,"y");
	fcg_asym->SetLabelSize(0.02,"x");
	fcg_asym->Draw();
	c1->Modified();
	c1->Update();

// ps->NewPage();
fcug_asym->SetLabelSize(0.02,"y"); fcug_asym->SetLabelSize(0.02,"x"); fcug_asym->Draw();
// c1->Modified();
c1->Update();
// ps->NewPage();
fcg_dist->SetLabelSize(0.02,"y"); fcg_dist->SetLabelSize(0.02,"x"); fcg_dist->Fit("myfit"); fcg_dist->Draw();
// c1->Modified();
c1->Update();
// ps->NewPage();
fcug_dist->SetLabelSize(0.02,"y"); fcug_dist->SetLabelSize(0.02,"x"); fcug_dist->Draw(); fcug_dist->Fit("myfit");
// c1->Modified();
c1->Update();
// ps->NewPage();
TorusDist->SetLabelSize(0.02,"y"); TorusDist->SetLabelSize(0.02,"x"); TorusDist->Draw(); c1->Update(); c1->Modified(); BEnergyDist->SetLabelSize(0.02,"y"); BEnergyDist->SetLabelSize(0.02,"x"); BEnergyDist->Draw(); c1->Update(); c1->Modified(); e_countSall->SetLabelSize(0.02,"y"); e_countSall->SetLabelSize(0.02,"x"); p_countSall->SetLabelSize(0.02,"y"); p_countSall->SetLabelSize(0.02,"x"); pip_countSall->SetLabelSize(0.02,"y"); pip_countSall->SetLabelSize(0.02,"x"); pim_countSall->SetLabelSize(0.02,"y"); pim_countSall->SetLabelSize(0.02,"x"); e_countSall->Draw(); c1->Modified(); c1->Update();
// ps->NewPage();
c1->Clear(); c1->Divide(1,3); c1_1->cd(); c1_1->SetGrid(); e_countS1->Draw(); c1_2->cd(); c1_2->SetGrid(); e_countS2->Draw(); c1->cd(3); gPad->SetGrid(); e_countS3->Draw(); c1->Update(); c1->Modified(); ps->NewPage(); c1->cd(1); gPad->SetGrid(); e_countS4->Draw(); c1->cd(2); gPad->SetGrid(); e_countS5->Draw(); c1->cd(3); gPad->SetGrid(); e_countS6->Draw(); c1->Modified(); c1->Update(); ps->NewPage(); c1->Clear(); p_countSall->Draw(); c1->Update(); c1->Modified();
// ps->NewPage();
c1->Clear(); c1->Divide(1,3); c1->cd(1); gPad->SetGrid(); p_countS1->Draw(); c1->cd(2); gPad->SetGrid(); p_countS2->Draw(); c1->cd(3); gPad->SetGrid(); p_countS3->Draw(); c1->Update(); c1->Modified(); ps->NewPage(); c1->cd(1); gPad->SetGrid(); p_countS4->Draw(); c1->cd(2); gPad->SetGrid(); p_countS5->Draw(); c1->cd(3); gPad->SetGrid(); p_countS6->Draw(); c1->Modified(); c1->Update(); ps->NewPage(); c1->Clear(); pip_countSall->Draw(); c1->Update(); c1->Modified();
// ps->NewPage();
c1->Clear(); c1->Divide(1,3); c1->cd(1); gPad->SetGrid(); pip_countS1->Draw(); c1->cd(2); gPad->SetGrid(); pip_countS2->Draw(); c1->cd(3); gPad->SetGrid(); pip_countS3->Draw(); c1->Update(); c1->Modified(); ps->NewPage(); c1->cd(1); gPad->SetGrid(); pip_countS4->Draw(); c1->cd(2); gPad->SetGrid(); pip_countS5->Draw(); c1->cd(3); gPad->SetGrid(); pip_countS6->Draw(); c1->Modified(); c1->Update(); ps->NewPage(); c1->Clear(); pim_countSall->Draw(); c1->Update(); c1->Modified();
// ps->NewPage();
c1->Clear(); c1->Divide(1,3); c1->cd(1); gPad->SetGrid(); pim_countS1->Draw(); c1->cd(2); gPad->SetGrid(); pim_countS2->Draw(); c1->cd(3); gPad->SetGrid(); pim_countS3->Draw(); c1->Update(); c1->Modified(); ps->NewPage(); c1->cd(1); gPad->SetGrid(); pim_countS4->Draw(); c1->cd(2); gPad->SetGrid(); pim_countS5->Draw(); c1->cd(3); gPad->SetGrid(); pim_countS6->Draw(); c1->Modified(); c1->Update(); ps->Close(); f->Write();
Received on Mon May 22 2006 - 03:40:39 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET