The Definition and Background of OFD
OFD (Open Fixed-layout Document) is a fixed-layout document format standard issued by the Standardization Administration of the People's Republic of China, with the standard number GB/T 33190-2016. Unlike PDF, which was created by Adobe and later became the ISO 32000 international standard, OFD is a national standard independently developed by China, designed to address the issue of autonomous control in the fixed-layout document domain.
The core characteristic of a fixed-layout document is "locked layout"—the document's layout, fonts, and image positions are fixed at creation time, and it renders identically regardless of the device used to open it. This contrasts with "reflowable documents" such as Word and HTML, which reflow based on screen size, font availability, and other factors. Fixed-layout documents lock the layout, ensuring what you see is what you get.
An OFD file uses XML to describe the document structure and is organized as a ZIP package—essentially a compressed container holding multiple XML files and media resources. It supports text, images, graphics, signatures, seals, and animations, and precisely preserves the document's visual layout. The standard was driven toward industrialization by the Fixed-layout Document Industry Alliance (OFD Alliance) and was published as a national recommended standard in 2016.
Since 2020, OFD has been widely adopted in the electronic official document systems of Party and government organs, gradually becoming the de facto standard for fixed-layout documents in the government sector. Today, OFD files are increasingly common in scenarios such as electronic invoices, electronic licenses, and electronic contracts. Understanding the technical system of OFD has become prerequisite knowledge for handling government documents and interfacing with government-enterprise systems.
OFD vs PDF: A Technical Comparison of Two Fixed-Layout Formats
OFD and PDF are both fixed-layout document formats with similar functional positioning—both are used to precisely preserve document layout and ensure cross-device consistency. However, the two differ significantly in their technical systems and ecosystems. Understanding these differences helps in choosing the right format for different scenarios.
| Dimension | OFD | |
|---|---|---|
| Format Standard | Chinese national standard GB/T 33190-2016 | ISO 32000 international standard (originated from Adobe) |
| File Structure | XML + ZIP container, open structure | Binary/text hybrid, relatively closed structure |
| Use Cases | Government documents, electronic licenses, bidding | General documents, contracts, reports, publications |
| Supported Tools | Few, mainly domestic tools like Suke, Foxit | Mature ecosystem, Adobe, Foxit, and many free tools |
| Seal/Signature Support | Native electronic seals, compliant with Chinese crypto standards | Digital signatures supported, Chinese crypto needs extra adaptation |
| International Recognition | Primarily domestic use | Globally accepted |
The flowchart below compares the technical paths of OFD and PDF across three dimensions: standard origin, file structure, and application ecosystem:
1. Format Standard
OFD is a Chinese national standard with publicly transparent technical specifications. Its document structure is based on XML, making it convenient for domestic adaptation and integration with Chinese cryptographic algorithms (SM2, SM3, SM4). PDF is an international standard with the most mature ecosystem and global adoption, but in classified and government scenarios, there are concerns regarding autonomous control. The two are not in a replacement relationship; they are parallel standards addressing different compliance requirements and application domains.
2. File Structure
This is the most fundamental technical difference between OFD and PDF. An OFD file is essentially a ZIP archive, with XML internally describing pages, text, images, and other elements—clearly structured and easy to parse. PDF uses a binary/text hybrid format, internally composed of objects, cross-reference tables, and trailer structures—relatively complex. For developers, OFD offers stronger readability and parsability; for end users, the visual appearance of both is similar when opened.
3. Supported Tools
PDF's tool ecosystem is extremely rich, ranging from free browser-embedded viewers to professional Adobe Acrobat, with editing, conversion, and compression tools of all kinds. By comparison, OFD's toolchain is still in its early stages of development. The number of software applications that can view and edit OFD is limited, and tools that support OFD compression are even scarcer. This is OFD's main shortcoming in its current ecosystem.
4. Seal and Signature Support
OFD natively supports electronic seals and seal verification compliant with Chinese cryptographic standards. Seal data is embedded as independent nodes in the document structure, meeting the requirements for authenticity, integrity, and non-repudiation in official document workflows. PDF supports digital signatures based on the PKI system, but requires additional development for Chinese cryptographic algorithm adaptation. In government document scenarios, OFD's seal system aligns more closely with the domestic cryptographic infrastructure.
OFD File Structure: The XML + ZIP Container
Understanding the OFD file structure is the foundation for understanding its compression methods and tool ecosystem. Unlike PDF's binary format, OFD adopts an "XML + ZIP container" architecture similar to modern office documents (such as OOXML, ODF).
Container Organization
An OFD file is essentially a ZIP archive. By changing its file extension to .zip and extracting it, you can see a clear multi-level directory structure. The outermost layer contains an OFD.xml entry file, which declares the document's basic information and physical file paths; internally, content is organized in a hierarchy of "Document (Doc)—Page—Object."
The XML Description Layer
OFD uses XML files to describe the document's logical structure and page content. Document.xml defines the document's page tree, outline, metadata, and so on; each page corresponds to a Content.xml that describes the text, images, graphics, paths, and other layout objects on that page along with their coordinates and styles. This XML-based description approach brings several characteristics:
- Strong readability: Any text editor can view OFD's page descriptions, facilitating debugging and auditing
- Easy to parse: Standard XML parsers can read the document structure without specialized binary parsers
- Good extensibility: Adding new features only requires extending the XML Schema without affecting existing structures
Comparison with PDF's Binary Format
PDF uses a binary/text hybrid format, internally composed of numbered objects linked together through a Cross-Reference Table, with the Trailer at the end of the file pointing to the root object. This design has advantages in file compactness, but the structure is opaque—ordinary users cannot directly view the internal content.
The difference between the two is also evident at the compression level: OFD is already a ZIP container, with internal resources having undergone a layer of compression, so re-compressing the whole file yields limited gains—the optimization focus is on internal resources (images, fonts). PDF's compression, on the other hand, is distributed across individual stream objects, where each stream object can independently choose its compression algorithm.
OFD Applications in Government Documents
OFD's promotion in the government sector has a practical background. Traditional government documents are primarily paper-based, and electronic transformation requires a fixed-layout format that precisely preserves layout, supports electronic seals, and complies with national cryptographic management requirements. Although PDF is powerful, as a foreign standard it raises autonomous control concerns in classified information systems. OFD, as a national standard, fills this gap.
Electronic Official Documents
Electronic official document systems in Party and government organs across many regions of China have adopted OFD as the standard format. The entire workflow of drafting, review, signing, distribution, and archiving uses OFD files as the carrier, combined with Chinese cryptographic electronic seals to achieve tamper resistance and traceability. OFD's fixed-layout characteristic ensures that documents maintain consistent layout across different office systems, without misformatting due to missing fonts or software differences.
Electronic Licenses
Electronic business licenses, real estate registration certificates, electronic ID cards, and other electronic licenses are gradually migrating to the OFD format. OFD files can embed license information, holder photos, issuing authority electronic seals, and support anti-forgery verification. Compared to paper licenses, OFD electronic licenses are more convenient for online verification and cross-department sharing.
Electronic Invoices
Electronic invoices in some regions have adopted the OFD format. OFD invoices contain structured data such as invoice codes, amounts, and tax amounts, while preserving the visual layout—convenient for both human reading and machine parsing. The seal mechanism of OFD invoices ensures authenticity and non-repudiation.
As application scale expands, OFD file size has become apparent—large numbers of scanned documents and high-definition seal images embedded in documents cause official documents to reach tens of MB, creating pressure on storage and transmission, and generating demand for OFD compression.
OFD Compression Methods
The principle of OFD compression is highly similar to PDF compression—the core is optimizing the parts that occupy the most space within the file. Since OFD is already a ZIP container whose file structure has undergone a layer of DEFLATE compression, the key to OFD compression is not adding another compression layer, but optimizing internal resources (images, fonts).
Image Resampling
Scanned documents and seal images in OFD files are typically the largest contributors to file size. A scanned official document may embed multiple 300dpi high-definition scanned pages, each several MB. Reducing high-resolution images to a reasonable resolution (e.g., from 300dpi to 150dpi) can significantly reduce size, with an acceptable impact on screen reading and printing.
Resampling requires balancing resolution and clarity: text content in government documents remains clearly legible at 150dpi, but the fine details of precision seals may require higher resolution. A sensible approach is to set different target resolutions based on image purpose.
Font Subsetting
OFD files embed complete fonts to ensure consistent display across devices, but a document typically uses only a small portion of the characters in a font file. Font subsetting retains only the character glyphs actually used in the document, discarding unused font data.
This technique is especially effective for Chinese documents. A complete Chinese font file typically contains tens of thousands of Chinese character glyphs and can exceed 10MB in size; however, a government document may use only one or two thousand Chinese characters, and subsetting can reduce font data by over 80%.
Cleaning Redundant Objects
An OFD package may contain unreferenced resources and duplicate objects: images deleted during editing may still linger in the resource directory, and multiple saves may produce duplicate metadata. Cleaning redundant objects involves traversing the document structure to remove all resources not referenced by pages, streamlining the document structure tree.
Image Format Optimization
OFD supports embedding multiple image formats, including uncompressed bitmaps (BMP) and compressed formats (JPEG, PNG). Converting uncompressed bitmaps to compressed formats like JPEG can directly reduce image resource usage. For seal graphics with large areas of solid color, PNG may be smaller than JPEG; for color-rich scanned photos, JPEG offers a higher compression ratio.
The following code demonstrates how to unzip an OFD file and analyze its internal resource usage—the first step in compression optimization:
import zipfile
import os
from collections import defaultdict
def analyze_ofd(ofd_path):
"""Unzip and analyze the internal resource usage of an OFD file"""
with zipfile.ZipFile(ofd_path, 'r') as zf:
# Tally the size of each file type
type_sizes = defaultdict(int)
type_counts = defaultdict(int)
total_size = 0
for info in zf.infolist():
ext = os.path.splitext(info.filename)[1].lower()
type_sizes[ext] += info.compress_size
type_counts[ext] += 1
total_size += info.compress_size
print(f"Total OFD size: {total_size / 1024 / 1024:.2f} MB\n")
print(f"{'Type':<12} {'Count':<8} {'Size(MB)':<12} {'Share'}")
print("-" * 45)
for ext, size in sorted(type_sizes.items(), key=lambda x: -x[1]):
pct = size / total_size * 100
print(f"{ext or '(none)':<12} {type_counts[ext]:<8} "
f"{size / 1024 / 1024:<12.2f} {pct:.1f}%")
# Usage example
# analyze_ofd("sample.ofd")
Running this kind of analysis script, you will typically find that over 80% of an OFD file's size comes from image resources (.jpg, .png, .bmp), with font files (.ttf, .otf) second. This confirms the core strategy of OFD compression: prioritize image optimization, then font optimization.
A 50MB OFD scanned official document, after reasonable image resampling and font subsetting, can typically be compressed to 8-12MB, with text and seals still clearly legible—fully meeting the requirements for government workflow and archiving.
The Current State of the OFD Tool Ecosystem
Although OFD's status as a national standard is clear, its tool ecosystem is far less mature than PDF's. Currently, software that can view OFD is mainly domestic tools such as the Suke reader and Foxit OFD; browsers do not natively support OFD preview, and tools that can compress OFD are even scarcer.
The weakness of the tool ecosystem brings two practical problems. First, ordinary users who receive an OFD file may not find a suitable tool to open it and need to download a dedicated reader. Second, when an OFD file is too large, the lack of ready-made compression tools means many users can only store or transmit it as-is, bearing storage and bandwidth costs.
From a technical perspective, OFD's open XML + ZIP structure means the barrier to parsing and processing is theoretically lower than PDF's binary format. The lag in the tool ecosystem is more a matter of market promotion and application scale than a technical obstacle. As OFD applications continue to expand in government and finance, the toolchain is expected to gradually mature.
Comparison Table: OFD vs PDF Compression Methods
| Compression Method | OFD Applicability | PDF Applicability | Notes |
|---|---|---|---|
| Image Resampling | High | High | Images dominate size in both; reducing resolution is most effective |
| Font Subsetting | High | High | Especially effective for Chinese docs; can cut font data by 80%+ |
| Cleaning Redundant Objects | Medium | Medium | Remove unreferenced resources and duplicates, streamline structure |
| Image Format Optimization | High | High | Convert bitmaps to JPEG; choose optimal format per image type |
| Whole-File ZIP Compression | Low (already ZIP) | Medium | OFD is already a ZIP container; re-compression yields little |
| Stream Object Compression | N/A | High | PDF-specific; each Stream can independently choose compression |
FAQ
Q1: Can OFD files be converted to PDF?
Yes. Some OFD readers and conversion tools support exporting OFD to PDF. However, note that OFD-specific information such as electronic seals may not be fully preserved during conversion, because OFD's Chinese cryptographic seal system and PDF's PKI signature system do not fully correspond. It is advisable to be cautious when converting in scenarios requiring long-term archiving or legal validity—back up before conversion and verify the seal status of the converted document.
Q2: Does OFD compression affect the validity of electronic seals?
Proper OFD compression only optimizes resources such as images and fonts, without modifying seal data or document hash verification information, so it does not affect the validity of electronic seals. However, note that a seal's integrity verification typically covers specific parts of the document—if the compression process modifies content protected by the seal, seal verification will fail. It is recommended to use professional tools and re-verify the seal status after compression to ensure the legal validity of the document is not compromised.
Q3: Do I need to use OFD for ordinary office scenarios?
For general business documents, PDF is sufficient. OFD is mainly used for government documents, electronic licenses, and other official scenarios. If you are not involved in government interfacing, there is no need to deliberately use OFD. However, if you need to exchange electronic official documents with government agencies or submit OFD-format bidding documents, you must use OFD. The two are not in a replacement relationship; the choice depends on compliance requirements and application scenarios.
Q4: Which is smaller in size, OFD or PDF?
There is no absolute answer. File size depends primarily on internal resources (images, fonts) rather than the container format itself. For identical content, OFD's XML description may be slightly larger than PDF's binary description, but both use compression, and the difference is usually negligible. The key factors determining size are image resolution and font embedding strategy, not the format choice. An OFD official document embedding many high-definition scanned pages will be far larger than a plain-text PDF, and vice versa.
Summary
OFD and PDF are both fixed-layout document formats, but they represent different technical paths and application ecosystems:
- OFD, as a Chinese national standard (GB/T 33190-2016), adopts an open XML + ZIP container structure, natively supports Chinese cryptographic electronic seals, and holds a stable position in domestic official scenarios such as government documents, electronic licenses, and electronic invoices. Its tool ecosystem is still in early development, but its open structure provides convenience for domestic adaptation and custom development.
- PDF, as an international standard (ISO 32000), adopts a binary/text hybrid format, with the most mature tool ecosystem globally, and is irreplaceable in general office scenarios.
The two are highly similar in compression methods—the core is optimizing embedded image and font resources. OFD compression's four key techniques (image resampling, font subsetting, cleaning redundant objects, image format optimization) share the same lineage as PDF compression, because the size composition principles of fixed-layout documents are universal.
The key to understanding OFD is grasping its "XML + ZIP container" essence: an open, parseable, easily adaptable fixed-layout architecture whose compression focus—like PDF's—is on internal resources, not the container itself.
Related Reading: