cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
jemg
Level III

solved

solved
MGO
1 REPLY 1
Craige_Hales
Super User

Re: How to get the total number of pages for JMP report in JSL?

Try something like this. With a little luck, and a small font, each report will stay on one page...

 

// use the journal to accumulate the reports.
// if they fit on a single page, the page count will be correct.
dt = Open( "$sample_data/big class.jmp", "invisible" );
report = dt << Distribution( Continuous Distribution( Column( :weight ) ), Nominal Distribution( Column( :age ) ) );
report << journal;
report << closewindow;

report = Bivariate( Y( :weight ), X( :height ), Fit Line );
report << journal;
report << closewindow;

report = Oneway( Y( :height ), X( :sex ), Means( 1 ), Mean Diamonds( 1 ) );
report << journal;
report << closewindow;

Close( dt, nosave );

// add the header and page breaks to the journal
j = Current Journal();
listOfReports = j << child;
nReports = N Items( listOfReports );

// add page breaks
For( i = N Items( listOfReports ), i >= 1, i--,
	Insert Into( listOfReports, Page Break Box(), i )
);

// and the header
headerPage = V List Box( 
	Text Box( "Big Report" ), 
	Text Box( Format( Today(), "yyyy-mm-dd" ) ), 
	Text Box( Char( nReports ) || " pages (reports)" ) 
);
Insert Into( listOfReports, headerPage, 1 );

// make the PDF from the journal
j<<savePDF("$desktop/report.pdf");

j<<closeWindow;

Opened PDF using FirefoxOpened PDF using Firefox

 

edit: you might want this too:

// make the PDF from the journal
j << setwindowtitle( " " ); // hide the title with a space
j << setpagesetup( {Margins( {0.75, 0.75, 0.75, 0.75} ), Scale( 1 ), Portrait( 1 ), Paper Size( "Letter" )} );
j << savePDF( "$desktop/report.pdf" );

The page setup might help, and cleaning out the window title makes it look a lot better!

@Anonymous 

Craige