interplane.Get Omega
Read in your language

omega-pdf

Omega PDF: read and write PDF files in Omega

Brought by drakestapleton

Unfinished: not checked yet

There is no published receipt of a rebuild from its source yet. What a receipt is

Get this repository
Git over HTTPS
git clone --no-checkout https://interplane.io/projects/omega-pdf/repo.git omega-pdf && git -C omega-pdf checkout --detach 49fc8290cfec8ccb38a1096f0100d7d7489ef104
Source archive of 49fc8290cfec8ccb38a1096f0100d7d7489ef104
Download ZIP · tar.gz

README.md

omega-pdf

opdf reads PDF files and copies pages between them. It is written only in seeded Omega and built by the pinned compiler (see PIN). It is written from the public standard ISO 32000-1:2008 (PDF 1.7); each rule's clause is cited in the source. No vendor program was disassembled or copied.

opdf info FILE.pdf                    version, page count, encryption, cross-reference and object streams, Info strings
opdf pages FILE.pdf                   per page: index, MediaBox (inherited, 7.7.3.4), Rotate, number of content streams
opdf text FILE.pdf [FIRST LAST]       the text of the pages, in content-stream order
opdf split FILE.pdf FIRST LAST OUT.pdf
opdf merge OUT.pdf A.pdf [B.pdf ...]

text prints text in the order the content streams draw it. This is the reading order as written in the file, not layout analysis: no columns, no sorting, no dehyphenation.

  • A newline is printed when the text position moves across the baseline by more than 0.5 times the effective font size.
  • One space is printed when it moves along the baseline by at least 0.12 times the effective font size beyond the end of the previous glyph.
  • Each page ends with LF then FF.

Unicode comes from the font's ToUnicode CMap (bfchar, bfrange in both forms, UTF-16 surrogates, multi-character destinations) when present (9.10.3). Otherwise it comes from the simple font's Encoding: StandardEncoding, WinAnsiEncoding, MacRomanEncoding and Differences with the Latin glyph names. The table is ISO 32000-1 Annex D.2/D.3, kept as data in src/text.om.

split and merge write a new file. It holds the selected pages and every object they reach: resources, fonts, and content and image streams copied byte for byte with no re-encoding. It also has a fresh page tree and catalog, the effective MediaBox/CropBox/Resources/Rotate written on each page, a classic cross-reference table and a trailer.

Build

cat src/head.om vendor/omega-zip/vendor/omega-mv/seed/text/text.om vendor/omega-zip/src/io.om vendor/omega-zip/src/crc32.om vendor/omega-zip/src/inflate.om vendor/omega-zip/src/zlibd.om src/core.om src/text.om src/writer.om src/main.om | OMC > opdf && chmod +x opdf

OMC is omega-mv 82e536e1 seed/out/omc, sha256 6d1b1cf5a44803389a831b67f750ea4cd1c9f53edfde9d6d9241d7352887f1f8. FlateDecode uses omega-zip's inflate at 28e91f99, vendored with S2's one-line sink.patch (vendor/omega-zip/PIN in omega-office records the hashes). src/core.om defines the wout sink.

Gate

OMC < tests/gate.om > build/gate-bin && chmod +x build/gate-bin && build/gate-bin OMC

The gate prints OPDFGATE PASS cases=N mutants-killed=K/K robust-runs=R, exit 0. It prints NOT_RUN and exits 3 when the compiler is not the pin. It runs installed oracles as test-only tools, never shipped: pdfinfo and pdftotext 24.02.0 (their outputs are recorded in corpus/expect), Ghostscript 10.02.1 (-dPDFSTOPONERROR -dPDFSTOPONWARNING -sDEVICE=nullpage, run live on every split and merge output as the structure checker), and pdftotext live on those outputs. qpdf and mutool are not installed. The corpus is described in corpus/SOURCES.txt, made by LibreOffice 24.2.7.2, pdfTeX 1.40.25 and tests/mkcases.om, with oracle verdicts in corpus/ORACLE.txt.

Before the cases the gate builds tests/docs.om with the same compiler and runs it: publication checks of the repository's own text. Its rules (tests/docrules.txt) refuse local home paths, a source or README note citing a file outside the repository or missing from it, a note leaving a question open, a missing licence, and a sentence saying an exit code has no case when tests/cases.txt has one. It prints DOCS PASS ... mutants-killed=K/K (its own mutants, tests/docmutants.txt, each putting back a defect bay 7 found at 9b4164be); any other result fails the gate.

Text comparison normalisation:

  • Every run of ASCII whitespace (including LF and FF) becomes one space, and leading and trailing whitespace is removed.
  • U+FB00..U+FB04 are expanded to ff/fi/fl/ffi/ffl on both sides.

Difference classes against the oracles:

  1. Line structure and trailing blanks. pdftotext places line breaks by its own layout rules. On the rotated pdfTeX page it breaks after every word, and it drops trailing spaces. These are removed by the whitespace normalisation.
  2. Ligatures. Annex D maps the glyph names fi and fl to U+FB01 and U+FB02. pdftotext expands them. Removed by the ligature expansion.
  3. Info strings that are not ASCII. info prints strings raw, with bytes outside printable ASCII as \xHH; pdfinfo decodes UTF-16 and PDFDocEncoding. These values are not compared and are counted as info-strings-not-compared.
  4. Glyph names outside Annex D (for example ff, ffi, dotlessj in pdfTeX T1 fonts). pdftotext resolves them through the Adobe Glyph List; opdf prints U+FFFD. No corpus page shows such a code.
  5. Symbolic fonts without Encoding or ToUnicode. Only Differences codes are mapped; other shown codes print U+FFFD, because the font program's built-in encoding is not read.
  6. Standard-14 fonts without Widths. Spacing uses MissingWidth or 500/1000 em, so spaces may differ (none in the corpus).
  7. Repairs. pdftotext and Ghostscript repair damaged files: bad startxref, xref offsets, Prev cycles, missing endstream. opdf refuses them, because reconstruction is not in this slice.

Exit codes

CodeMeaning
0done
1usage, or page range outside the document
2cannot open the input
5cannot create the output (it must not exist already; exclusive creation)
3read error inside the vendored inflate input (pread)
10..21DEFLATE stream errors (omega-zip S1 codes)
30bad zlib header
31zlib preset dictionary
32Adler-32 mismatch
60malformed PDF: startxref, cross-reference data, object header, stream Length/endstream, page tree. No reconstruction
61encrypted (trailer Encrypt). Not supported in this slice
62unsupported filter or predictor for that stream: LZW, RunLength, DCT, JBIG2, CCITT, JPX, Crypt, external (F) stream data, TIFF predictor. Only jobs that need that stream are refused
63a bound or structural cycle (page-tree cycle, Prev cycle, reference chains, nesting, sizes, work)
64I/O error (read, seek, or stdout write)
65text: unsupported font or CMap (CID font without ToUnicode, any CID Encoding other than Identity-H, vertical writing, form XObjects and inline images carrying text)
66text: malformed content stream, font or CMap
67split/merge: an object that cannot be copied (a reference to an ObjStm or XRef stream itself, external stream data, a duplicate page, a direct stream)
68split/merge: write error on the output

Refusal cases in the gate cover 1, 2, 5, 10..21, 30..32, 60, 61, 62, 63, 64 (a directory as input), 65, 66 and 67. Codes 3 and 68 have no case: a regular file cannot make pread or pwrite fail without fault injection.

Bounds (each refused with its code, never a trap)

  • Object numbers 65535; parsed nodes 262143; object stream objects 65536; cross-reference sections in a Prev chain 1024 (63).
  • Container nesting 64; reference chain and object-load depth 64; decode/filter depth 64.
  • Names 256 bytes; strings 65536 bytes; numeric tokens 128 bytes.
  • Decoded stream held in memory 16 MiB (content streams, CMaps, object streams, xref streams); decoded-byte pool 16 MiB.
  • Pages 4096 per input; page-tree depth 64; work 100000000 lexical/output steps per run.
  • Text: operands 4096, operand bytes 1 MiB, literal-string nesting 256, q/Q depth 32, 4096 font loads per page, ToUnicode 65536 entries with 512 bytes per destination, 64 codespace ranges, text per page 16 MiB.
  • Writer: 65535 output objects, 65535 output pages, 4095 inputs, 4194304 copy steps per input and pass, output at most 9999999999 bytes (10-digit xref offsets).

Static buffers only: there is no heap.

Not supported in this slice

Encryption; LZW, RunLength and image-filter decoding (DCT, JBIG2, CCITT, JPX), though image streams are copied untouched by split and merge; CID fonts without ToUnicode; vertical writing; layout analysis; forms (AcroForm) and text inside form XObjects; annotations (pages are copied with their Annots, and references to pages that are not copied become null); incremental-update writing; linearization on output; damaged-file reconstruction.

Next slice

A real writer for new PDFs: content-stream generation, fonts (embedding a subset with Widths and ToUnicode), compression on output (needs a deflate compressor, which does not exist in Omega yet), plus the Annex D Symbol/ZapfDingbats sets and reading font programs' built-in encodings.

Caveat

If an input changes between the writer's preflight pass and its copy pass and its zlib data then fails, a partial OUT can remain. The exit status is non-zero (10..32).

For developers: proof and records

The full record of this project. Words that are used only here are explained once:

ID
The project's permanent id on Interplane: the SHA-256 of its first signed record. This one is git:43b82091c3f3ebf8b3cdedec1b3e1872e9f483b207d7ebf1b441f03e381e1149. Its old id, kept only so that old links still work: z3KEetRBZZ3kZVdcpzrBxCSrrhsKu.
Owner
The key that signs every record of the project. This forge lists the project under drakestapleton; its key is SHA256:qg3vxoE9ul3Cgk5heosQvPmO9pqIJNsdcsGJ2cHghTs.
Refs and HEAD
Refs are the names that point at versions: branches and tags. HEAD is the version a fresh copy starts from, the newest commit of the default branch.
Patch
A proposed change, reviewed before it is merged. This forge does not show proposed changes from its own store yet. The list is under Proposed changes.
Receipt
A public record that someone checked a claim, with the fingerprint of its evidence file. The state at the top of this page is read from the list at interplane.io/receipts. This project has no receipt in that list yet.

Clones and fetches over HTTPS: 0 by visitors (git smart-HTTP info/refs requests answered 200 in the front-door download log; our own addresses and bots left out; since 2026-11-08) · not measured git-upload-pack requests from all clients (the source of this count is retired)

Downloads: 1 by visitors (1 source archives, 0 release assets; forged access log; our own addresses left out; since 2026-11-07)

commit 49fc8290cfec8ccb38a1096f0100d7d7489ef104 Branches Tags History
49fc829 docs: retire the hand-made Chinese README; readers translate with their own tools Drake Stapleton committed 2026-11-11
corpus/
src/
tests/
vendor/
.gitignore7
LICENSE11358
PIN359
README.md8919

Every record: History (commits) · Branches · Tags · Releases, with the SHA-256 of each download · Patches · Issues · This project as JSON