All formats

CAJ (China Academic Journals)

Full nameChina Academic Journals full-text format (CNKI)
Extensions.caj, .kdh, .nh, .caa (link to a document, not the document itself)
MIME typenone registered
Typedocument format for academic papers; container for a PDF or for page images and text
Starts with43 41 4A 00 (CAJ), 48 4E (HN), 4B 44 48 20 (KDH), 25 50 44 46 (%PDF) or C8, depending on the variant
Specificationnone published; only reverse-engineered descriptions
Maintained byCNKI (China National Knowledge Infrastructure, Tongfang Knowledge Network)
Licenseproprietary

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#

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 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#

Specifications and documentation#

Software that opens CAJ files#

SoftwareWindowsmacOSLinuxWebCanNotes
SumatraPDF✓viewfree, open source; opens CAJ, KDH and NH on 64-bit Windows by converting to PDF
CAJViewer✓✓viewofficial free reader from CNKI; opens every variant. Also on Android and iOS
caj2pdf-rust✓✓✓convertCAJ to PDF on the command line; also a JavaScript/WebAssembly package; MIT
caj2pdf✓✓✓convertPython command-line converter
caj2pdf-qt✓✓✓convertGUI for caj2pdf

Libraries#

Open-source libraries that read CAJ files. See all CAJ libraries for a comparison.

Pythoncaj2pdf
Rustcaj2pdf-core