{ "name": "qpdf", "version": "12.4.2", "summary": "qpdf: repairs, linearises, splits, merges, encrypts, decrypts and recompresses PDF files (--optimize-images)", "category": "tool", "license": "Apache-2.0 OR Artistic-2.0", "homepage": "https://qpdf.sourceforge.io/", "source": { "url": "https://github.com/qpdf/qpdf/releases/download/v12.4.2/qpdf-12.4.2.tar.gz", "sha256": "8a58af5b6141319287c1883bec8bd1bd545b7567b7fc5e6ce5d25a1c85f36397" }, "watch": { "kind": "github-release", "repo": "qpdf/qpdf", "tag_regex": "^v([0-9]+\\.[0-9]+\\.[0-9]+)$" }, "deps": [ "zlib", "libjpeg-turbo" ], "env_packages": [], "static": true, "nss": false, "check": "t=$(mktemp -d) && bin/qpdf --version | has '^qpdf version 12\\.4\\.2' && python3 -c 'import sys; img = bytes(((x * y * 31 + x * 7) % 256 if c == 0 else (x * 2) % 256 if c == 1 else (y * 2) % 256) for y in range(128) for x in range(128) for c in range(3)); page = b\"q 0.2 0.4 0.8 rg 20 20 160 60 re f Q q 200 0 0 200 220 20 cm /Im1 Do Q BT /F1 24 Tf 20 120 Td (Hello WebPortico) Tj ET\"; objs = [b\"<< /Type /Catalog /Pages 2 0 R >>\", b\"<< /Type /Pages /Kids [3 0 R] /Count 1 >>\", b\"<< /Type /Page /Parent 2 0 R /MediaBox [0 0 440 240] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> /XObject << /Im1 6 0 R >> >> >>\", b\"<< /Length %d >>\\nstream\\n\" % len(page) + page + b\"\\nendstream\", b\"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\", b\"<< /Type /XObject /Subtype /Image /Width 128 /Height 128 /ColorSpace /DeviceRGB /BitsPerComponent 8 /Length %d >>\\nstream\\n\" % len(img) + img + b\"\\nendstream\"]; out = b\"%PDF-1.4\\n\"; offs = []; exec(\"for i, o in enumerate(objs):\\n offs.append(len(out))\\n out += b\\\"%d 0 obj\\\\n\\\" % (i + 1) + o + b\\\"\\\\nendobj\\\\n\\\"\"); x = len(out); out += b\"xref\\n0 %d\\n0000000000 65535 f \\n\" % (len(objs) + 1) + b\"\".join(b\"%010d 00000 n \\n\" % o for o in offs) + b\"trailer\\n<< /Size %d /Root 1 0 R >>\\nstartxref\\n%d\\n%%%%EOF\\n\" % (len(objs) + 1, x); open(sys.argv[1], \"wb\").write(out)' \"$t/a.pdf\" && bin/qpdf --check \"$t/a.pdf\" > /dev/null && s0=$(stat -c %s \"$t/a.pdf\") && bin/qpdf --linearize --object-streams=generate --compress-streams=y --recompress-flate --compression-level=9 --optimize-images --oi-min-width=64 --oi-min-height=64 --oi-min-area=4096 \"$t/a.pdf\" \"$t/o.pdf\" && s1=$(stat -c %s \"$t/o.pdf\") && [ \"$s1\" -lt \"$s0\" ] && bin/qpdf --check-linearization \"$t/o.pdf\" > /dev/null && bin/qpdf --show-npages \"$t/o.pdf\" | has -x 1 && bin/qpdf --qdf --object-streams=disable \"$t/o.pdf\" - | has -a DCTDecode && bin/qpdf --encrypt --user-password=u --owner-password=o --bits=256 -- \"$t/o.pdf\" \"$t/e.pdf\" && bin/qpdf --password=u --decrypt \"$t/e.pdf\" \"$t/d.pdf\" && bin/qpdf --show-npages \"$t/d.pdf\" | has -x 1 && [ -s share/doc/qpdf/LICENSE.txt ] && echo \"qpdf 12.4.2: a one-page PDF linearised with object streams and its 128x128 image turned into JPEG ($s0 to $s1 bytes), encrypted with AES-256 and decrypted again; its licence in share/doc/qpdf\"" }