嘿 JMP 社區
我是 JSL 的新手,過去一周左右一直在編寫腳本。 腳本的最後部分應該採用圖表並將其保存為 PDF。 我遇到的問題是我似乎無法找到將這個 PDF 縮小到一頁的方法。
我可以通過單擊圖形窗口中的“另存為”、選擇 PDF 文件格式並將比例設置為 80% 來手動執行此操作。
目前,我的代碼如下所示:
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);
其中“KlingonImage”是為顯示圖形而創建的窗口的名稱。 無論我製作什麼比例值,生成的 PDF 文件似乎都沒有任何變化。 這是JMP可以做到的嗎? 應該注意的是,我使用的是 JMP 9。
謝謝,
邁克爾
當您將其添加到腳本末尾時會發生什麼?
gb <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> Set page setup<SPAN class="token punctuation">(</SPAN> margins<SPAN class="token punctuation">( 0.5, 0.5, 0.5, 0.5 </SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> scale<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">.1</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> portrait<SPAN class="token punctuation">(</SPAN> 0 <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> paper size<SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"Letter"</SPAN> <SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token comment">gb << save pdf( "testPDF.pdf" );</SPAN>
我懷疑你會得到一個 pdf(在保存腳本的目錄中),它看起來像頁面左上角的棒球卡。
請注意,對於“縱向”參數,1 是縱向,0 是橫向。
嘿拜倫
回复晚了非常抱歉。 我不相信這可以解決我遇到的問題。 我希望所有內容都只適合一頁。 我唯一想放在頁面上的是這個元素:
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()
);這本質上是一個帶有文本框疊加在其上的圖像。 我遇到的問題是我似乎無法影響 PDF 文件的比例。 我嘗試縮放的窗口類型是我無法操作的數據類型嗎?
謝謝,
邁克爾
米,
您要壓縮的報告有多複雜/多大?
也許 v9 有一些特別之處,我曾經在 v7 中做過類似的事情,而且效果很好。
在此示例中,當我將報表片段放在一起時,我添加了一個分頁框()。 創建 PDF 時,它會生成頁面製動,因此不會以剪裁不佳的報告對象結束,而是在我想要的地方發生中斷。
-B
obj = New Window( "KPI Report " || Long Date( Today() ),
V List Box( "vlb1", Panel Box( "Figure 1", graph1 ), <STRONG>Page Break Box()</STRONG>, Panel Box( "Figure 2", graph2 ) ));
@michaelgroom寫道:
嘿 JMP 社區
我是 JSL 的新手,過去一周左右一直在編寫腳本。 腳本的最後部分應該採用圖表並將其保存為 PDF。 我遇到的問題是我似乎無法找到將這個 PDF 縮小到一頁的方法。
我可以通過單擊圖形窗口中的“另存為”、選擇 PDF 文件格式並將比例設置為 80% 來手動執行此操作。
目前,我的代碼如下所示:
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);
其中“KlingonImage”是為顯示圖形而創建的窗口的名稱。 無論我製作什麼比例值,生成的 PDF 文件似乎都沒有任何變化。 這是JMP可以做到的嗎? 應該注意的是,我使用的是 JMP 9。
謝謝,
邁克爾
<BR /> 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" );