嘿 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 ) ));
@迈克尔新郎写道:
嘿 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" );