<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Scaling to fit to page width in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/35041#M20682</link>
    <description>&lt;P&gt;There is a better way that also works in JMP 10:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;journal &amp;lt;&amp;lt; set Print Headers( "", "", "" );
journal &amp;lt;&amp;lt; save pdf( "$temp\test.pdf" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;removing the print headers (and footers if necessary) makes the PDF page look a lot better.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PDF without JMP headers" style="width: 373px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/4939i9EE4F62EFFFEF8A1/image-size/large?v=v2&amp;amp;px=999" role="button" title="pdf.PNG" alt="PDF without JMP headers" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;PDF without JMP headers&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jan 2017 18:51:04 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2017-01-27T18:51:04Z</dc:date>
    <item>
      <title>Scaling to fit to page width</title>
      <link>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/33952#M20127</link>
      <description>&lt;P&gt;JMP page setup comes with a scale to fit to page, but i would like to do this in a script without having to use a static scalar. &amp;nbsp;Is this possible, a "fit to page width"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Specifically, I'd like to make it so that the script will automatically select a scalar for the "Set Page Setup" command based on page layout (Portrait or Landscape, Margin sizes)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; Journal &amp;lt;&amp;lt; Set page setup(&lt;BR /&gt; margins( .4, .4, .4, .4 ),&lt;BR /&gt; scale( .67 ), portrait( 0 ),&lt;BR /&gt; paper size( "Letter" )&lt;BR /&gt; );&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like it to be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Journal &amp;lt;&amp;lt; Set page setup(
margins( .4, .4, .4, .4 ), portrait( 0 ),
paper size( "Letter" )
);
ScaleVariable = /* current page setup width divided by maximum width of objects in journal*/ ;
Journal &amp;lt;&amp;lt; Set Page Setup( scale ( ScaleVariable ) ) ;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2016 19:18:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/33952#M20127</guid>
      <dc:creator>nacka</dc:creator>
      <dc:date>2016-12-28T19:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Scaling to fit to page width</title>
      <link>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/34661#M20466</link>
      <description>&lt;P&gt;Did I stump everyone?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 15:07:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/34661#M20466</guid>
      <dc:creator>nacka</dc:creator>
      <dc:date>2017-01-17T15:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Scaling to fit to page width</title>
      <link>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/35030#M20678</link>
      <description>&lt;P&gt;If it helps, I'm using JMP 10.0.2&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 16:15:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/35030#M20678</guid>
      <dc:creator>nacka</dc:creator>
      <dc:date>2017-01-27T16:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Scaling to fit to page width</title>
      <link>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/35038#M20680</link>
      <description>&lt;P&gt;this works pretty well in JMP 12. &amp;nbsp;JMP 11 does not remove the extra page decorations, and JMP 10 needs help sending the parameters to the SetPageSetup message. (Recommending upgrade to 12 (or 13!) if possible.)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;
// your parameters - paper size and margins
pagewidth = 8.5;
pageheight = 11;
left = .4;
right = .4;
top = .4;
bottom = .4;

dt = Open( "$sample_data/big class.jmp" );

// your reports
//plat = dt &amp;lt;&amp;lt; runscript( "bivariate" );
//plat &amp;lt;&amp;lt; journal;
//plat &amp;lt;&amp;lt; closewindow;

plat = dt &amp;lt;&amp;lt; runscript( "fit model" );
plat &amp;lt;&amp;lt; journal;
plat &amp;lt;&amp;lt; closewindow;

journal = Current Journal();

saved = Get Preferences( "print settings" ); // remember decorations, if any
Preferences( Print Settings( Left Header( "" ), Right Header( "" ) ) ); // remove decorations

{xpix, ypix} = journal &amp;lt;&amp;lt; getsize;

marginx = left + right;
marginy = top + bottom;
xinch = pagewidth - marginx;
yinch = pageheight - marginy;
xppi = xpix / xinch;
yppi = ypix / yinch;
ppi = Max( xppi, yppi );
scale = 96 / Ceiling( ppi ); // a little guesswork here. 
// 96 is the pixels per inch of the destination. 72 is another common possibility.
// force the larger dimension to fit.  you could pick a different strategy, make the
// width fit perhaps, or have a minimum scale you don't go below.
Journal &amp;lt;&amp;lt; Set page setup( margins( left, top, right, bottom ), scale( scale ), portrait( 1 ), paper size( "Letter" ) ); 
 
journal &amp;lt;&amp;lt; save pdf( "$temp\test.pdf" );
journal &amp;lt;&amp;lt; closewindow;
Open( "$temp\test.pdf" );
 
eval( saved );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For JMP 11 or 10, remove the preference save/set/restore and for JMP 10 use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// for JMP 10, this will have to suffice...

// your parameters - paper size and margins
pagewidth = 8.5;
pageheight = 11;
left = .4;
right = .4;
top = .4;
bottom = .4;

dt = Open( "$sample_data/big class.jmp" );

// your reports
//plat = dt &amp;lt;&amp;lt; runscript( "bivariate" );
//plat &amp;lt;&amp;lt; journal;
//plat &amp;lt;&amp;lt; closewindow;

plat = dt &amp;lt;&amp;lt; runscript( "fit model" );
plat &amp;lt;&amp;lt; journal;
plat &amp;lt;&amp;lt; closewindow;

journal = Current Journal();

//saved = Get Preferences( "print settings" ); // remember decorations, if any
//Preferences( Print Settings( Left Header( "" ), Right Header( "" ) ) ); // remove decorations

{xpix, ypix} = journal &amp;lt;&amp;lt; getsize;

marginx = left + right;
marginy = top + bottom;
xinch = pagewidth - marginx;
yinch = pageheight - marginy;
xppi = xpix / xinch;
yppi = ypix / yinch;
ppi = Max( xppi, yppi );
scale = 96 / Ceiling( ppi ); // a little guesswork here. 
// 96 is the pixels per inch of the destination. 72 is another common possibility.
// force the larger dimension to fit.  you could pick a different strategy, make the
// width fit perhaps, or have a minimum scale you don't go below.
eval(evalexpr(
Journal &amp;lt;&amp;lt; Set page setup( margins( expr(left), expr(top), expr(right), expr(bottom) ),
 scale( expr(scale) ), portrait( 1 ), paper size( "Letter" ) )
)); 
 
journal &amp;lt;&amp;lt; save pdf( "$temp\test.pdf" );
journal &amp;lt;&amp;lt; closewindow;
Open( "$temp\test.pdf" );
 
//eval( saved );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm not 100% confident in the hard-coded 96 DPI value, and there may be some rounding errors that the ceiling function is incorrectly trying to account for.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 18:40:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/35038#M20680</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2017-01-27T18:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Scaling to fit to page width</title>
      <link>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/35041#M20682</link>
      <description>&lt;P&gt;There is a better way that also works in JMP 10:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;journal &amp;lt;&amp;lt; set Print Headers( "", "", "" );
journal &amp;lt;&amp;lt; save pdf( "$temp\test.pdf" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;removing the print headers (and footers if necessary) makes the PDF page look a lot better.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PDF without JMP headers" style="width: 373px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/4939i9EE4F62EFFFEF8A1/image-size/large?v=v2&amp;amp;px=999" role="button" title="pdf.PNG" alt="PDF without JMP headers" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;PDF without JMP headers&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 18:51:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/35041#M20682</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2017-01-27T18:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Scaling to fit to page width</title>
      <link>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/35139#M20729</link>
      <description>&lt;P&gt;This is beautiful! Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 16:44:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/35139#M20729</guid>
      <dc:creator>nacka</dc:creator>
      <dc:date>2017-01-31T16:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Scaling to fit to page width</title>
      <link>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/472828#M71744</link>
      <description>&lt;P&gt;Thanks for sharing this.&lt;/P&gt;&lt;P&gt;I have difficulty in running this part:&lt;/P&gt;&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;scale( expr(scale) )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It seems jmp16 does not recognize this as a numeric value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;It only works if I put a number there.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 18:24:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/472828#M71744</guid>
      <dc:creator>VA103</dc:creator>
      <dc:date>2022-03-24T18:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Scaling to fit to page width</title>
      <link>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/472881#M71750</link>
      <description>&lt;P&gt;The original snip of JSL looks like this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;eval(evalexpr(
Journal &amp;lt;&amp;lt; Set page setup( margins( expr(left), expr(top), expr(right), expr(bottom) ),
 scale( expr(scale) ), portrait( 1 ), paper size( "Letter" ) )
)); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The extra eval(evalexpr( ... expr(...) ...)) functions are working around a problem that existed in the JMP 10 time (and apparently still exists.) The problem was/is in the &amp;lt;&amp;lt;SetPageSetup method for a journal. That method did not evaluate the arguments to margins() and scale() properties, thus requiring them to be specified as constants. The extra stuff is a way to workaround the problem. It means find each of the expr(...) wrappers and replace them with their value, then eval the whole thing. &lt;EM&gt;It is a pattern for substituting a variable's value for the variable&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you left out the eval/evalexpr wrapper.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: sent a note to development team.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 13:47:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scaling-to-fit-to-page-width/m-p/472881#M71750</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-03-28T13:47:38Z</dc:date>
    </item>
  </channel>
</rss>

