由于很多元素和属性涉及到后面的文件,所以这里只讲Document文档中必须的元素和属性,其他的留待后面详解。
Document根元素
Document根元素有以下子元素
CommonData:文档公共数据,定义了页面区域、公共资源等数据;必须。Pages:页树,包含Page子元素,必须。Page:页面
Outlines:大纲;非必须。Permissions:CT_Permission类型,文档的权限声明;非必须。Actions:文档关联的动作序列,依次执行,包含Action子元素;非必须。Action:CT_Action类型,文档关联的动作。
VPreferencesCT_VPreferences类型,文档的视图首选项;非必须。Bookmarks:文档的书签集,包含Bookmarks子元素;非必须。Bookmark:CT_Bookmark类型,文档的标签。
Annotations:ST_Loc路径类型,指向注释列表文件;非必须。CustomTags:ST_Loc路径类型,指向自定义标引列表文件;非必须。Attachments:ST_Loc路径类型,指向附件列表文件;非必须。Extensions:ST_Loc路径类型,指向扩展列表文件;非必须。
CommonData子元素
CommonData包含以下子元素:
MaxUnitID:ST_ID标识类型,当前文档中所有对象使用标识的最大值,初始值是0;必须。PageArea:CT_PageArea类型,指定该文档页面区域的默认大小和位置;必须。PublicRes:ST_Loc路径类型,公共资源序列,一般存放字型和颜色空间等公共资源描述,指向OFD包内的资源描述文档,可以有多个;非必须。DocumentRes:ST_Loc路径类型,文档资源序列,指向OFD包内的资源描述文档;非必须。TemplatePage:CT_TemplatePage类型,模板页序列,为一系列模板页的集合;非必须。DefaultCS:ST_RefID引用标识类型,引用在资源文件中定义的颜色空间标识;如果此项不存在,采用RGB作为默认颜色空间,非必须。
PageArea元素和CT_PageArea类型
PageArea元素是CT_PageArea类型,它包含以下子元素,它们都是ST_Box类型:
PhysicalBox:页面物理区域,坐标原点为页面空间坐标系的左上角;必须。ApplicationBox:显示区域,实际显示或打印输出的区域,在页面物理区域之内;非必须。ContentBox:版心区域,文件的正文区域,位于显示区域内。其左上角在显示区域内的位置决定了它的位置;非必须。BleedBox:出血区域,即超出设备性能限制的额外区域,位于页面物理区域外。没有被定义时,默认值为页面物理区域;非必须
这4个元素的关系如下图所示:

Pages页树元素及Page属性
Pages页树元素包含多个Page子元素,Page子元素包含2个属性:
ID:ST_ID标识类型,声明该页的标识,不能与已有标识重复;必须。BaseID:ST_Loc路径类型,指向页对象描述文件;必须。
Document简易代码示例及结构图
<?xml version="1.0" encoding="utf-8"?>
<ofd:Document xmlns:ofd="http://www.ofdspec.org/2016">
<ofd:CommonData>
<ofd:MaxUnitID>0</ofd:MaxUnitID>
<ofd:PageArea>
<ofd:PhysicalBox>PhysicalBox1</ofd:PhysicalBox>
<ofd:ApplicaitonBox>ApplicaitonBox1</ofd:ApplicaitonBox>
<ofd:ContentBox>ContentBox1</ofd:ContentBox>
<ofd:BleedBox>BleedBox1</ofd:BleedBox>
</ofd:PageArea>
<ofd:PublicRes>http://uri1</ofd:PublicRes>
<ofd:PublicRes>http://uri2</ofd:PublicRes>
<ofd:PublicRes>http://uri3</ofd:PublicRes>
<ofd:DocumentRes>http://uri1</ofd:DocumentRes>
<ofd:DocumentRes>http://uri2</ofd:DocumentRes>
<ofd:DocumentRes>http://uri3</ofd:DocumentRes>
<ofd:TemplatePage ID="http://uri1" Name="Name1" ZOrder="Background" BaseLoc="http://uri1" />
<ofd:TemplatePage ID="http://uri2" Name="Name2" ZOrder="Foreground" BaseLoc="http://uri2" />
<ofd:TemplatePage ID="http://uri3" Name="Name3" ZOrder="Background" BaseLoc="http://uri3" />
<ofd:DefaultCS>0</ofd:DefaultCS>
</ofd:CommonData>
<ofd:Pages>
<ofd:Page ID="0" BaseLoc="http://uri1" />
<ofd:Page ID="4294967295" BaseLoc="http://uri2" />
<ofd:Page ID="1" BaseLoc="http://uri3" />
</ofd:Pages>
<ofd:Annotations>http://uri1</ofd:Annotations>
<ofd:CustomTags>http://uri1</ofd:CustomTags>
<ofd:Attachments>http://uri1</ofd:Attachments>
<ofd:Extensions>http://uri1</ofd:Extensions>
</ofd:Document>

1581

被折叠的 条评论
为什么被折叠?



