cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
DerekMoore
Level II

Set Page Setup for PDF not working as expected

Hello all,

 

I am running the following code to try and adjust the Page Setup settings for this PDF before exporting it to my desktop. An example of my code looks like this:

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

nw = New Window ("Charts",
	obj = dt << Control Chart Builder( Variables( Y( :height, :weight ) ), Show Control Panel( 0 ), SendToReport(
		
	) );
);

nw << Set page setup(
    margins( 0.75, 0.75, 0.75, 0.75 ),
    scale( 0.8 ),
    portrait( 1 ),
    paper size( "Tabloid" )
);
	
nw << Save PDF ("Desktop\EXAMPLE.pdf");

When using this, the PDF document "EXAMPLE" gets to my Desktop but does not seem to take into consideration the 'Set page setup' portion of my code. It is also not throwing an error when getting to the 'Set page setup' line, so it appear to be trying to work, but not actually working.

 

I also seem to be unable to add the Boolean 1 in the Save PDF function to make the Page Setup pop-up happen.

 

Does anyone know what I might have done wrong to cause this?

 

Thanks

4 REPLIES 4
jthi
Super User

Re: Set Page Setup for PDF not working as expected

For me it seems to be working fine when using JMP17.0. Which version of JMP are you using? Also the path to Desktop might be incorrect (try to add $)

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

nw = New Window("Charts",
	obj = dt << Control Chart Builder(
		Variables(Y(:height, :weight)),
		Show Control Panel(0),
	);
);

nw << Set page setup(margins(0.75, 0.75, 0.75, 0.75), scale(0.2), portrait(1), paper size("Tabloid"));
	
nw << Save PDF("$Desktop\EXAMPLE.pdf");
Open("$Desktop\EXAMPLE.pdf");

at least scale does work

jthi_0-1683545423189.png

 

-Jarmo
DerekMoore
Level II

Re: Set Page Setup for PDF not working as expected

I am using JMP 17.0. The PDF file was not having issues with exporting to my desktop. Using this code,

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

nw = New Window("Charts",
	obj = dt << Control Chart Builder(
		Variables(Y(:height, :weight)),
		Show Control Panel(0),
	);
);

nw << Set page setup(margins(0.75, 0.75, 0.75, 0.75), scale(0.2), portrait(1), paper size("Tabloid"));
	
nw << Save PDF("$Desktop\EXAMPLE.pdf");
Open("$Desktop\EXAMPLE.pdf");

nw << Set page setup(margins(0.5, 0.5, 0.5, 0.5), scale(0.8), portrait(0), paper size("Letter"));

nw << Save PDF("$Desktop\EXAMPLE 2.pdf");
Open("$Desktop\EXAMPLE 2.pdf");

I set the Page Setup portion up two separate ways and the two PDFs that are exporting look exactly the same (EXAMPLE and EXAMPLE 2). This is the reason I believe the 'page setup' portion is not being considered. Are you saying you do not have this issue?

 

Edit: I am able to get the above to export two different PDFs now. My issue was because the JMP script I was using was being housed inside a project. As far as I can tell, 'Set page setup' instructions do no work when they are within a script, within a project. Is there a workaround currently available for this?

jthi
Super User

Re: Set Page Setup for PDF not working as expected

Maybe creating journal of the new window would help with the project issue?

-Jarmo
DerekMoore
Level II

Re: Set Page Setup for PDF not working as expected

Appreciate the suggestion! I tried moving the charts to a journal and then running 'Set page setup' from there but that did not appear to have an impact on the exported PDF. When running the below, making changes to the 'Set page setup'  function still does not affect the PDF.

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

nw = New Window("Charts",
	obj = dt << Control Chart Builder(
		Variables(Y(:height, :weight)),
		Show Control Panel(0),
	);
);

nw << Set page setup(margins(0.75, 0.75, 0.75, 0.75), scale(0.8), portrait(1), paper size("Tabloid"));
nw << Journal();
nw_journal = Current Journal();
	
nw_journal << Save PDF("$Desktop\EXAMPLE.pdf");
Open("$Desktop\EXAMPLE.pdf");

Please let me know if this is not the proper way to go about adding the 'Charts' window to a journal. Thanks!