Subscribe Bookmark RSS Feed

Scaling a window to be saved as a PDF?

michaelgroom

New Contributor

Joined:

Jul 6, 2017

Hey JMP Community

 

I am new to JSL, and have been working on a script for the past week or so. The final portion of the script is supposed to take a graph and save it as a PDF. The issue I am having is that I cannot seem to find a way to scale this PDF down to one page.

 

I can do this manually by clicking "Save As" in the graph window, choosing the PDF file format, and setting the scale to 80%.

 

Currently, my code looks like this:

 

KlingonImage << Set Page Setup(
	margins(0.5,0.5,0.5,0.5),
	scale(0.8)
);

KlingonImage << Get Page Setup();

//Save as PDF

KlingonImage << Savepdf(filepath);

Where "KlingonImage" is the name of the window created to display the graph. No matter what I make the scale value, there does not seem to be any change in the resulting PDF file. Is this something that JMP can do? It should be noted that I am using JMP 9.

 

Thanks,

Michael

4 REPLIES
Byron_JMP

Staff

Joined:

Apr 26, 2012

M,

How complex/big is the report you're trying to compress?  

Maybe there is something special about v9, I used to do something like this in v7 and it worked fine.

In this example when I put the report pieces together I added a Page Break Box(). When the PDF is created the it generates a page brake, so instead of ending up with poorly clipped report objects, the breaks happen where I want them.

-B

 

obj = New Window( "KPI Report " || Long Date( Today() ),
	V List Box( "vlb1", Panel Box( "Figure 1", graph1 ), Page Break Box(), Panel Box( "Figure 2", graph2 ) ));

michaelgroom wrote:

Hey JMP Community

 

I am new to JSL, and have been working on a script for the past week or so. The final portion of the script is supposed to take a graph and save it as a PDF. The issue I am having is that I cannot seem to find a way to scale this PDF down to one page.

 

I can do this manually by clicking "Save As" in the graph window, choosing the PDF file format, and setting the scale to 80%.

 

Currently, my code looks like this:

 

KlingonImage << Set Page Setup(
	margins(0.5,0.5,0.5,0.5),
	scale(0.8)
);

KlingonImage << Get Page Setup();

//Save as PDF

KlingonImage << Savepdf(filepath);

Where "KlingonImage" is the name of the window created to display the graph. No matter what I make the scale value, there does not seem to be any change in the resulting PDF file. Is this something that JMP can do? It should be noted that I am using JMP 9.

 

Thanks,

Michael



obj << Set page setup( margins( 1, 1, 1, 1 ), scale( .5 ), portrait( 1 ), paper size( "Letter" ) ); path = Get Default Directory(); //t=Format Date( Today(), "ddmonyyyy" ); obj << save pdf( path || "testPDF.pdf" );

 

michaelgroom

New Contributor

Joined:

Jul 6, 2017

 Hey  Byron

 

Sorry for the late response. I don't believe this fixes the issue that I am having. I want everything to fit on only one page. The only thing that I want to fit on the page is this element:

KlingonImage=New Window("Klingon Pattern",
	gb=Graph Box(
	
		Frame Size(810,810),
		xaxis(show major ticks(false),show minor ticks(false),show labels(false)),
		yaxis(show major ticks(false),show minor ticks(false),show labels(false)),
		X Scale(0,100),
		Y Scale(0,100),
		
		<< Add Image(
			Open(filepath||fid1),
			Bounds(
				Left(20),
				Right(80),
				Top(100),
				Bottom(0)
			)
		),
		Text Size(11);
		Text Color("black"),
		Text(Center Justified,Boxed,{50,3.9},NFrame), //North Frame
		
		Text(Center Justified,Boxed,{40,96},SETFrame), //Southeast Top Frame
		
		Text(Center Justified,Boxed,{60,96},SWTFrame), //Southwest Top Frame
		
		Text(Center Justified,Boxed,{50,9},NWindow), //North Window
		
		Text(Center Justified,Boxed,{50,81.5},SWindow), //South Window
		
		Text(Center Justified,Clockwise,Boxed,{36.5,80},SEWindowOut), //Outer Southeast Window
		
		Text(Center Justified,Clockwise,Boxed,{62.5,80},SWWindowOut), //Outer Southwest Window
		
		Text(Center Justified,Clockwise,Boxed,{62.5,12},NWWindowOut), //Outer Northwest Window
		
		Text(Center Justified,Clockwise,Boxed,{36.5,12},NEWindowOut), //Outer Northeast Window
			
		Text(Center Justified,Clockwise,Boxed,{74.3,27},NWFrame), //Northwest Frame	
		
		Text(Center Justified,Clockwise,Boxed,{25,27},NEFrame), //Northeast Frame
		
		Text(Center Justified,Clockwise,Boxed,{74.3,72},SWFrame), //Southwest Frame
		
		Text(Center Justified,Clockwise,Boxed,{25,72},SEFrame), //Southeast Frame
		
		Text(Center Justified,Clockwise,Boxed,{42,30},NEWindowIn), //Inner Northeast Window
		
		Text(Center Justified,Clockwise,Boxed,{42,63},SEWindowIn), //Inner Southeast Window
		
		Text(Center Justified,Clockwise,Boxed,{57.7,30},NWWindowIn), //Inner Northwest Window
		
		Text(Center Justified,Clockwise,Boxed,{57.6,63},SWWindowIn), //Inner Southwest Window
		
		Text(Center Justified,Boxed,{34,45.5},NEGap), //Northeast Gap
		
		Text(Center Justified,Boxed,{34.4,51},SEGap), //Southeast Gap
		
		Text(Center Justified,Boxed,{67,45.5},NWGap), //Northwest Gap
		
		Text(Center Justified,Boxed,{67,51},SWGap), //Southwest Gap
		
		Text Color("Blue"),
		
		Text({74,5},Operator), //Operator
		
		Text({74,1},TestDate); //Date
		
		Text({74,3},NumberSamp); //Number of Samples used in generation
		
	),
	Page Break Box()
);

Which is essentially an image with text boxes superimposed over it. The issue I am having is that I cannot seem to affect the scale of the PDF file. Is the type of window I am trying to scale a data type I cannot manipulate?

 

Thanks,

Michael

Byron_JMP

Staff

Joined:

Apr 26, 2012

what happens when you add this to the end of your script?

 

 gb << Set page setup( margins( 0.5, 0.5, 0.5, 0.5 ), scale( .1 ), portrait( 0 ), paper size( "Letter" ) );
gb << save pdf( "testPDF.pdf" );

 I suspect you'll get a pdf (in the directory where the script is saved) that looks like A baseball card on the top left of the page.

note, for the "portrait" argument, 1 is portrait and 0 is landscape. 

michaelgroom

New Contributor

Joined:

Jul 6, 2017

Unfortunately, adding the suggested lines does not change the scale. I am wondering if this is a limitation of JMP 9?

Thanks,

Michael