CAJ (China Academic Journals)
| Full name | China Academic Journals full-text format (CNKI) |
|---|---|
| Extensions | .caj, .kdh, .nh, .caa (link to a document, not the document itself) |
| MIME type | none registered |
| Type | document format for academic papers; container for a PDF or for page images and text |
| Starts with | 43 41 4A 00 (CAJ), 48 4E (HN), 4B 44 48 20 (KDH), 25 50 44 46 (%PDF) or C8, depending on the variant |
| Specification | none published; only reverse-engineered descriptions |
| Maintained by | CNKI (China National Knowledge Infrastructure, Tongfang Knowledge Network) |
| License | proprietary |
CAJ is the download format of CNKI, the largest database of Chinese journals, dissertations and conference papers. Many documents, especially master’s and doctoral theses, are only offered as CAJ. The official reader is CAJViewer.
The .caj extension covers several different internal formats. Some are a lightly modified PDF, so open-source converters turn them into a normal PDF with text and bookmarks. Others (HN, C8) store each page as images (JBIG, JBIG2 or JPEG) plus compressed text, and converters produce image-only or partially reconstructed pages.
When to use CAJ#
- Use only because CNKI offers no other download for a document. Choose the PDF download when CNKI offers one.
- Avoid for storing or sharing papers: convert CAJ to PDF so any reader and reference manager (Zotero, EndNote) can open it.
File structure#
No official specification exists. This summary follows the open-source converters caj2pdf and caj2pdf-rust, whose authors reverse-engineered the formats. Integers are 32-bit little-endian.
Variants#
| First bytes | Variant | Contents |
|---|---|---|
CAJ\0 |
CAJ | header, table of contents, then a PDF body without the %PDF header and with a broken object structure |
HN |
HN | header, table of contents, per-page records; each page has compressed text and one or more images (JBIG, JPEG, JBIG2) |
C8 (one byte 0xC8) |
C8 | like HN, without a table of contents |
KDH |
KDH | a PDF obfuscated with XOR |
%PDF |
a normal PDF with a .caj extension |
|
TEB |
TEB | encrypted; no open-source converter |
The extension doesn’t tell the variant: a .caj file can be any of them, and .nh files seen in the wild contain HN data. Always check the first bytes.
CAJ variant#
| Offset | Contents |
|---|---|
0x00 |
CAJ magic |
0x10 |
number of pages |
0x14 |
offset of a pointer to the start of the embedded PDF data |
0x110 |
number of table-of-contents entries, followed by the entries |
Each table-of-contents entry is 0x134 bytes: a 256-byte title (GB18030 text, zero-terminated), a page number stored as ASCII text and the nesting level. To convert, a tool copies the PDF data, adds a %PDF-1.3 header, rebuilds the page tree and catalog, repairs the cross-reference table (caj2pdf uses mutool clean), and adds bookmarks from the table of contents. The result has real, selectable text.
HN and C8 variants#
After the header (page count at 0x90 in HN files) and the table of contents, an array of 20-byte page records gives each page’s data offset, text size and image count. Page data starts with a text section, often zlib-compressed and marked COMPRESSTEXT, followed by the page images. JBIG and JBIG2 images use CNKI-specific variations. Converters can always rebuild image pages; rebuilding text pages needs the fonts that CAJViewer uses.
KDH variant#
Skip the first 254 bytes, XOR the rest with the repeating key FZHMEI, and cut the data after the last %%EOF. The result is a PDF, usually with a damaged cross-reference table that a repair tool fixes.
Converting CAJ to PDF#
- caj2pdf-rust: a single binary for Windows, macOS and Linux:
caj2pdf paper.caj -o paper.pdf. Converts CAJ and KDH with bookmarks; HN, C8 and NH are experimental. MIT. - caj2pdf (Python):
caj2pdf convert paper.caj -o paper.pdf. Converts CAJ and KDH; HN support is incomplete. - CAJViewer: open the file and print to a PDF printer. This always works, but pages become images and bookmarks are lost;
caj2pdf outlinescan add the bookmarks back. - SumatraPDF on 64-bit Windows opens CAJ, KDH and NH files by converting them to PDF in the background.
Specifications and documentation#
- caj2pdf wiki: reverse-engineered description of the CAJ and HN formats (Chinese)
- caj2pdf-rust research notes and support matrix: what each variant contains and what converts
- CAJSamples: sample files for testing converters
- CNKI on Wikipedia
Software that opens CAJ files#
| Software | Windows | macOS | Linux | Web | Can | Notes |
|---|---|---|---|---|---|---|
| SumatraPDF | ✓ | view | free, open source; opens CAJ, KDH and NH on 64-bit Windows by converting to PDF | |||
| CAJViewer | ✓ | ✓ | view | official free reader from CNKI; opens every variant. Also on Android and iOS | ||
| caj2pdf-rust | ✓ | ✓ | ✓ | convert | CAJ to PDF on the command line; also a JavaScript/WebAssembly package; MIT | |
| caj2pdf | ✓ | ✓ | ✓ | convert | Python command-line converter | |
| caj2pdf-qt | ✓ | ✓ | ✓ | convert | GUI for caj2pdf |
Libraries#
Open-source libraries that read CAJ files. See all CAJ libraries for a comparison.
| Python | caj2pdf |
|---|---|
| Rust | caj2pdf-core |