# Adobe Portable Document FormatVersion 1.5 Adobe PDF file formate SPEC Reference: https://www.adobe.com/devnet/pdf/pdf_reference_archive.html :::danger 該文件(Adobe PDF file formate SPEC)對於開發操作 PDF 文件可能沒有給予直接的助益。 請參閱本文並審慎評估後,再決定你的選擇。建議將該文件視為補充相關知識之用。 ::: :::info ⭐️ 為 重點章節 ✅ 為 推薦閱讀 ::: ## Chapter 1: Introduction 1 ✅ ### 1.1 About This Book 1 ### 1.2 Introduction to PDF 1.5 Features 4 ### 1.3 Related Publications 5 ### 1.4 Intellectual Property 6 ## Chapter 2: Overview 9 2.1 Imaging Model 10 2.2 Other General Properties 14 2.3 Creating PDF 19 2.4 PDF and the PostScript Language 21 ## Chapter 3: Syntax 23 3.1 Lexical Conventions 24 3.2 Objects 27 3.3 Filters 41 3.4 File Structure 66 3.5 Encryption 91 3.6 Document Structure 111 3.7 Content Streams and Resources 124 3.8 Common Data Structures 129 3.9 Functions 138 3.10 File Specifications 150 ## Chapter 4: Graphics 163 4.1 Graphics Objects 164 4.2 Coordinate Systems 169 4.3 Graphics State 179 4.4 Path Construction and Painting 194 4.5 Color Spaces 205 4.6 Patterns 252 4.7 External Objects 295 4.8 Images 297 4.9 Form XObjects 319 4.10 Optional Content 327 ## Chapter 5: Text 349 ✅ ### 5.1 Organization and Use of Fonts 350 #### 5.1.1-Basics of Showing Text ⭐️ - 我們用 font 定義 chracters 的形狀,並將該形狀稱做 glyphs。 - 這樣的字體程序是用專用語言(例如Type 1或TrueType字體格式)編寫的,專用語言解釋器可以理解該語言。 - 對於大多數字體類型,字體程序本身是在單獨的字體文件中定義的,該文件可以嵌入 PDF stream object 中,也可以從外部源獲取。 - 為了要顯示每個字,閱讀器軟體會執行 glyph description。 - 在預設的用戶坐標系中,這也代表標準字形的大小為1個單位,或1/72英寸。 #### 5.1.2-Achieving Special Graphical Effects - Tj和其他字形繪製操作符的正常使用會導致黑色填充的字形被繪製。 - 第 5.2.5 章 “Text Rendering Mode” 介紹僅描邊與不描邊還有填充的文字。 - 第 4.5.7 章 “Color Operators” 介紹文字填充的顏色可使用一個或多個顏色。 #### 5.1.3-Glyph Positioning and Metrics ⭐️⭐️⭐️ - 字形的寬度(通常是其水平位移)是其沿水平書寫的一行文本的基線佔據的空間量。 - 請注意,寬度與字形輪廓的尺寸不同。 - 大多數用於高質量排版的字體與每個 Glyph 有不同的寬度,這樣的字體稱為比例字體或可變間距字體。 - 無論是等距字體或是可變間距字體,Tj運算符都根據其寬度來定位字符串的連續字形。 - 每個字形的寬度信息都存儲在字體字典和字體程序本身中。 - 對於大多數字體類型,此信息主要在字體程序內部,並且在PDF字體字典中未明確指定; - 但是,在 Type 3 字體中,所有 metrics 均已明確指定(請參見第5.5.4節“ Type 3字體”)。 - 字形坐標系是定義單個字符的字形的空間,所有描繪路徑坐標和度量均在此空間中解釋。 - 對於除 Type 3 之外的所有字體類型,字形空間的單位 是 文本空間單位 的千分之一; ``` BT 40 50 Td // 在用戶坐標系中將文本空間的原點調整為(40,50) (ABC) Tj // 然後將A字形的原點放置在該點: ET ``` - 字形位移是從 Glyph 的原點到在繪製一行文本的連續字形時通常應放置下一個字形的原點的距離。 - 大多數西方書寫系統,包括那些基於拉丁字母的書寫系統,都具有正的水平位移和零的垂直位移。 - 在所有情況下,顯示文本的運算符都將位移向量轉換為文本空間,然後按該量轉換文本空間。 - 字形邊界框是最小的矩形(以字形坐標系的軸為方向),它將包圍整個字形形狀。 - 當字形具有兩組度量時,每組都為該書寫模式指定字形原點和位移矢量。 - 在垂直書寫中,字形的位置由從用於水平書寫的原點(原點0)到用於垂直書寫的原點(原點1)的位置向量來描述。 ![](https://i.imgur.com/oUCQx0P.png) ### 5.2 Text State Parameters and Operators 358 ⭐️⭐️ ### 5.3 Text Objects 366 ⭐️⭐️⭐️ ### 5.4 Introduction to Font Data Structures 373 ⭐️⭐️ ### 5.5 Simple Fonts 374 ⭐️⭐️⭐️ ### 5.6 Composite Fonts 395 ⭐️⭐️ ### 5.7 Font Descriptors 417 ⭐️⭐️ ### 5.8 Embedded Font Programs 427 ### 5.9 Extraction of Text Content 430 ## Chapter 6: Rendering 437 6.1 CIE-Based Color to Device Color 438 6.2 Conversions among Device Color Spaces 440 6.3 Transfer Functions 444 6.4 Halftones 446 6.5 Scan Conversion Details 468 ## Chapter 7: Transparency 473 7.1 Overview of Transparency 474 7.2 Basic Compositing Computations 476 7.3 Transparency Groups 489 7.4 Soft Masks 503 7.5 Specifying Transparency in PDF 505 7.6 Color Space and Rendering Issues ## Chapter 8: Interactive Features 537 8.1 Viewer Preferences 537 8.2 Document-Level Navigation 540 8.3 Page-Level Navigation 547 8.4 Annotations 558 8.5 Actions 592 8.6 Interactive Forms 611 8.7 Digital Signatures 659 ## Chapter 9: Multimedia Features 675 9.1 Multimedia 675 9.2 Sounds 703 9.3 Movies 705 9.4 Alternate Presentations 707 ## Chapter 10: Document Interchange 711 10.1 Procedure Sets 712 10.2 Metadata 713 10.3 File Identifiers 717 10.4 Page-Piece Dictionaries 718 10.5 Marked Content 720 10.6 Logical Structure 726 10.7 Tagged PDF 752 10.8 Accessibility Support 805 10.9 Web Capture 815 10.10 Prepress Support 833 ## Appendix Appendix A: Operator Summary 857 Appendix B: Operators in Type 4 Functions 861 B.1 Arithmetic Operators 861 B.2 Relational, Boolean, and Bitwise Operators 862 B.3 Conditional Operators 862 B.4 Stack Operators 862 Appendix C: Implementation Limits 863 C.1 General Implementation Limits 864 C.2 Implementation Limits Affecting Web Capture 866 Appendix D: Character Sets and Encodings 867 D.1 Latin Character Set and Encodings 869 D.2 Expert Set and MacExpertEncoding 873 D.3 Symbol Set and Encoding 876 D.4 ZapfDingbats Set and Encoding 879 Appendix E: PDF Name Registry 881 Appendix F: Linearized PDF 883 F.1 Background and Assumptions 884 F.2 Linearized PDF Document Structure 886 F.3 Hint Tables 900 F.4 Access Strategies 913 Appendix G: Example PDF Files 919 G.1 Minimal PDF File 919 G.2 Simple Text String Example 922 G.3 Simple Graphics Example 924 G.4 Page Tree Example 927 G.5 Outline Hierarchy Example 932 G.6 Updating Example 936 Appendix H: Compatibility and Implementation Notes 945 H.1 PDF Version Numbers 945 H.2 Feature Compatibility 948 H.3 Implementation Notes 949 Appendix I: Computation of Object Digests 979 I.1 Basic Object Types 979 I.2 Selective Computation 981 Chapter 10: Color Plates 987 Bibliography 999 --- --- ## iOS SDK 的 PDF 坐標空間描述 > Note that most objects on a page are specified in page space, rather than view space. That is, the coordinate system is in points (72 points per inch), with the origin at the bottom left of the page, not the view. Page space doesn’t care about zooming, display mode, and so on. An item that has bounds of, say 32 points square, retains those bounds regardless of display size. ### 解讀: - PDF 文件內使用 page space () - 操作 `view` 使用原有的 view space () ![](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/PDFKitGuide/Art/view_vspage_space.gif) ## 周邊豆知識 - [可攜式文件格式(英語:Portable Document Format,縮寫:PDF) wikipedia](https://zh.wikipedia.org/zh-tw/可移植文档格式) - [PostScript(PS)是主要用於電子產業和桌面出版領域的一種頁面描述語言和程式語言。](https://zh.wikipedia.org/zh-tw/PostScript) - [桌面出版(Desktop publishing,DTP)是指在電腦上運用版面設計技巧來建立文件](https://zh.wikipedia.org/zh-tw/桌面出版) - [PDF描述一個或多個頁面的內容和外觀,它的大小可達五種不同的說明,被稱為頁框(Page Box)](http://www.netprint101.com/text/43373744-262.html)