【发布时间】:2023-03-28 16:15:01
【问题描述】:
目前我无法生成带有不错书签和目录的漂亮 pdf。
理想情况下,我希望有一个如下所示的 pdf 文档:
第 1 页(标题页,纵向)
第 2 页(目录,纵向)
第 3 页及以后(子类别中的所有表格,横向)
我的基本做法是这样的:
options orientation=portrait nocenter nodate nonumber;
ods pdf file="C:\xyz.pdf" style=sasweb;
ods escapechar='^';
/* Title page */
title;
ods pdf text="^S={just=c} ^20n Document XYZ";
/* ---------- */
/* Table of contents */
ods pdf startpage=now;
title "Contents";
ods pdf text="Classes A & B";
ods pdf text="^S={URL='#Tab1'} Table 1: Class A";
ods pdf text="^S={URL='#Tab2'} Table 2: Class B";
ods pdf text="Classes C & D";
ods pdf text="^S={URL='#Tab3'} Table 3: Class C";
ods pdf text="^S={URL='#Tab4'} Table 4: Class D";
/* ----------------- */
ods pdf startpage=now; /* Start new page ... */
ods pdf startpage=no; /* ... and define no pagination */
title;
options orientation=landscape;
/* Table list */
%macro make_table(in_data=,title=,link=);
ods pdf anchor="&link";
ods proclabel="&title";
ods pdf text="^2n &title";
proc print data=&in_data contents='' noobs;
run;
%mend;
ods pdf text="Classes A & B";
/* Table 1 */
%make_table(in_data=sashelp.class,title=Table 1: Class A,link=Tab1);
/* Table 2 */
%make_table(in_data=sashelp.class,title=Table 2: Class B,link=Tab2);
ods pdf startpage=now;
ods pdf text="Classes C & D";
/* Table 3 */
%make_table(in_data=sashelp.class,title=Table 3: Class C,link=Tab3);
/* Table 4 */
%make_table(in_data=sashelp.class,title=Table 4: Class D,link=Tab4);
/* ---------- */
ods pdf close;
通过所有这些设置,我遇到了几个问题:
- 关于 pdf 书签和目录,我希望有指向表标题(例如“表 1”)和子类别(例如“A 类和 B 类”)的链接,其中子类别在书签中应该在第 1 级,表标题在第 2 级。但是,“ods pdf 锚”语句似乎只查找下一个过程,而不是下一个“ods pdf 文本”语句(我更喜欢) .有什么方法可以简单地实现这一点?
- 单击超链接和书签对我来说完全是一团糟:有时列名会被截断(因此我必须向上滚动才能看到它们),并且表 3 和表 4 的超链接将我带到另一个目的地,然后相应的书签。
- 无论出于何种原因,从表 1 到其标题的距离都小于所有其他表。
这很可能是因为我对输出交付系统缺乏经验,但我现在已经为这些看似简单的问题苦苦挣扎了好几个小时。希望有人可以帮助我。
【问题讨论】:
-
没有想法?我在这里上传了生成的 .pdf 文件:link。也许这样,我的意思就更清楚了。
标签: pdf hyperlink sas bookmarks tableofcontents