縮放以適合頁面寬度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
回覆:縮放以適應頁面寬度我難倒大家了嗎?