缩放以适合页面宽度JMP 页面设置带有适合页面的比例,但我想在脚本中执行此操作,而不必使用静态标量。 这可能是“适合页面宽度”吗?
具体来说,我想让脚本根据页面布局(纵向或横向、边距大小)自动为“设置页面设置”命令选择一个标量
当前脚本:
Journal << Set page setup(
margins( .4, .4, .4, .4 ),
scale( .67 ), portrait( 0 ),
paper size( "Letter" )
);
我希望它是
Journal << 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 << Set Page Setup( scale ( ScaleVariable ) ) ;
回复:缩放以适应页面宽度JSL 的原始片段如下所示
eval(evalexpr(
Journal << Set page setup( margins( expr(left), expr(top), expr(right), expr(bottom) ),
scale( expr(scale) ), portrait( 1 ), paper size( "Letter" ) )
));
额外的 eval(evalexpr( ... expr(...) ...)) 函数正在解决 JMP 10 中存在的问题(并且显然仍然存在。)该问题位于 <这是一种用变量的值替换变量的模式。
我认为您遗漏了 eval/evaexpr 包装器。
编辑:向开发团队发送了一条说明。
回复:缩放以适应页面宽度感谢您分享这个。
我在运行这部分时遇到困难:
scale( expr(scale) )
看来 jmp16 不能将其识别为数值。
有什么建议么?
只有当我在那里输入数字时它才有效。
谢谢,
回复:缩放以适应页面宽度这很漂亮! 谢谢你!
回复:缩放以适应页面宽度有一种更好的方法也适用于 JMP 10:
journal << set Print Headers( "", "", "" );
journal << save pdf( "$temp\test.pdf" );
删除打印页眉(必要时还可以删除页脚)使 PDF 页面看起来更好。
PDF without JMP headersPDF without JMP headers不带 JMP 标题的 PDF
回复:缩放以适应页面宽度这在 JMP 12 中效果很好。JMP 11 不会删除额外的页面装饰,而 JMP 10 需要帮助将参数发送到 SetPageSetup 消息。 (如果可能的话,建议升级到 12(或 13!)。)
// 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 << runscript( "bivariate" );
//plat << journal;
//plat << closewindow;
plat = dt << runscript( "fit model" );
plat << journal;
plat << 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 << 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 << Set page setup( margins( left, top, right, bottom ), scale( scale ), portrait( 1 ), paper size( "Letter" ) );
journal << save pdf( "$temp\test.pdf" );
journal << closewindow;
Open( "$temp\test.pdf" );
eval( saved );
对于 JMP 11 或 10,删除首选项保存/设置/恢复,对于 JMP 10 使用
// 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 << runscript( "bivariate" );
//plat << journal;
//plat << closewindow;
plat = dt << runscript( "fit model" );
plat << journal;
plat << 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 << 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 << Set page setup( margins( expr(left), expr(top), expr(right), expr(bottom) ),
scale( expr(scale) ), portrait( 1 ), paper size( "Letter" ) )
));
journal << save pdf( "$temp\test.pdf" );
journal << closewindow;
Open( "$temp\test.pdf" );
//eval( saved );
我对硬编码的 96 DPI 值不是 100% 有信心,并且上限函数可能错误地尝试解释一些舍入错误。
回复:缩放以适应页面宽度如果有帮助,我正在使用 JMP 10.0.2
回复:缩放以适应页面宽度我难倒了大家吗?