PDF檔案儲存結構

2021-06-18 03:35:31 字數 1188 閱讀 1995

pdf檔案由檔案頭(版本號)、檔案體(物件)、交叉索引表、和檔案尾四部分組成。

%pdf-1.4% 檔案頭,顯示版本資訊

% 檔案體,儲存著1 ~ n 個間接物件,其內部可以是所有型別的基礎物件(請檢視pdf基礎物件)。

1 0 obj

% 間接物件頭,表示 索引號為1,更新號(在文件增量更新的時候會用到)為 0

<<

/type /pages

/kids [2 0 r]

% kids under this node. 

% can be another page tree node, or a page dictionary

/count 1

>>

endobj % 間接物件結束標記

2 0 obj % 索引號為2 的間接物件

endobj

n 0 obj  % 索引號為n 的間接物件

endobj

xref

% cross reference table. 

% should contain byte offsets of all indirect objects

1 n************ 00000 n % 索引號為1的間接物件在檔案中的偏移位置

************ 00000 n % 索引號為n的間接物件在檔案中的偏移位置

************ 00000 n % 索引號為n的間接物件在檔案中的偏移位置

trailer

% 檔案尾,檔案尾必須包含size(間接物件個數)、info、

<<

/size 0

% should be the size of cross reference table

% we use 0 here for convenience.

/info 7 0 r     % doc info for author and so on

/root 3 0 r

% pointer to the catalog object 指向

>>

startxref

0% this should be the offset to the cross reference table.

% we use 0 here for convenience.

%%eof

% end of file

PDF學習二 PDF檔案物理結構

在pdf學習一 hello world中簡單提到了pdf檔案結構。本文將重點講pdf檔案結構,指的是其檔案物理組織方式,決定物件是如何存放在乙個pdf檔案中,它們是如何被訪問的,如何被更新的。掌握pdf基本物理結構。pdf檔案格式包含以下4個部分 指明了該檔案所遵從的pdf規範的版本號,它出現在pd...

使用canvas儲存網頁為pdf檔案支援跨域

前言 使用canvas儲存網頁為pdf檔案支援跨域 正文思路 繼續使用canvas截圖後將畫布內容轉換為pdf檔案。引入canvas的js檔案,js檔案獲取位址官網主頁 div按鈕 匯出為pdf按鈕 需要獲取為pdf的div jsp 此次網頁改為pdf,與上次截圖網頁為png,使用同一種技術,都是先...

使用canvas儲存網頁為pdf檔案支援跨域

前文 canvas截圖網頁為 思路 繼續使用canvas截圖後將畫布內容轉換為pdf檔案。引入canvas的js檔案,js檔案獲取位址官網主頁 div按鈕 匯出為pdf按鈕 需要獲取為pdf的div jsp 此次網頁改為pdf,與上次截圖網頁為png,使用同一種技術,都是先使用canvas截圖畫布後...