{"_id":"@alexsun-top/office2pdf","_rev":"2-8e4aa178154ee32d928ebed3867d686a","name":"@alexsun-top/office2pdf","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@alexsun-top/office2pdf","version":"0.1.0","license":"Apache-2.0","_id":"@alexsun-top/office2pdf@0.1.0","maintainers":[{"name":"alexsun-top","email":"6a6l6e6x@gmail.com"}],"bin":{"office2pdf":"dist/cli.js"},"dist":{"shasum":"0c5aaf86c5aa844ec50546eeb79112090b4092a4","tarball":"https://registry.npmjs.org/@alexsun-top/office2pdf/-/office2pdf-0.1.0.tgz","fileCount":19,"integrity":"sha512-68koEfRIco+EUspOeDisgd0dLE//MegPNBLxIj3jdOicuxpZCIdwBqaScy6rFAUNqc+SnvEXhvZ6Now+OYh8Qg==","signatures":[{"sig":"MEUCIQDKwVBHf8EoLsnQn3LsSW7ROPULIO2bctW3OAZodXKNnQIgNIXTWmL6sUMv+DCrg3E5+uGN+Zft+4kpCPLVExImxmQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44564110},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./cli":"./dist/cli.js"},"gitHead":"ec8b6ba3369f12d37081a67b36c48c7e86952516","private":false,"scripts":{"test":"vitest run","build":"npm run clean && npm run wasm:build && tsc -p tsconfig.build.json && npm run wasm:copy && npm run bin:chmod","check":"npm run typecheck && npm run test && npm run format:check","clean":"node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"","format":"prettier --write .","bin:chmod":"node -e \"require('node:fs').chmodSync('dist/cli.js', 0o755)\"","typecheck":"tsc -p tsconfig.json --noEmit","wasm:copy":"node -e \"const fs=require('node:fs'); fs.mkdirSync('dist/wasm',{recursive:true}); for (const file of ['office2pdf_wasm.js','office2pdf_wasm_bg.wasm','office2pdf_wasm.d.ts','office2pdf_wasm_bg.wasm.d.ts']) fs.copyFileSync('wasm/pkg/'+file, 'dist/wasm/'+file)\"","test:watch":"vitest","wasm:build":"(command -v wasm-pack >/dev/null 2>&1 && wasm-pack build rust --target nodejs --out-dir ../wasm/pkg --release) || npx --yes wasm-pack build rust --target nodejs --out-dir ../wasm/pkg --release","format:check":"prettier --check ."},"_npmUser":{"name":"alexsun-top","email":"6a6l6e6x@gmail.com"},"_npmVersion":"11.11.0","description":"Node-first TypeScript bindings for office2pdf via Rust/WASM.","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.8","prettier":"^3.4.2","typescript":"^5.7.3","@types/node":"^22.10.2"},"_npmOperationalInternal":{"tmp":"tmp/office2pdf_0.1.0_1781162718841_0.3806279405958646","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@alexsun-top/office2pdf","version":"0.1.1","description":"Node-first TypeScript bindings for office2pdf via Rust/WASM.","type":"module","license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/agentsyaml/office2pdf-ts.git"},"private":false,"engines":{"node":">=18"},"main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"office2pdf":"dist/cli.js"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./cli":"./dist/cli.js"},"scripts":{"clean":"node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"","build":"npm run clean && npm run wasm:build && tsc -p tsconfig.build.json && npm run wasm:copy && npm run bin:chmod","typecheck":"tsc -p tsconfig.json --noEmit","test":"vitest run tests/index.test.ts tests/cli.test.ts","test:real":"npm run build && vitest run tests/real-conversion.test.ts","test:watch":"vitest","smoke:installed":"node scripts/installed-package-smoke.mjs","test:smoke:installed":"npm run build && npm run smoke:installed","wasm:build":"(command -v wasm-pack >/dev/null 2>&1 && wasm-pack build rust --target nodejs --out-dir ../wasm/pkg --release --no-opt) || npx --yes wasm-pack build rust --target nodejs --out-dir ../wasm/pkg --release --no-opt","wasm:copy":"node -e \"const fs=require('node:fs'); fs.mkdirSync('dist/wasm',{recursive:true}); const source='wasm/pkg/office2pdf_wasm.js'; fs.copyFileSync(source, 'dist/wasm/office2pdf_wasm.cjs'); fs.copyFileSync('wasm/pkg/office2pdf_wasm.js','dist/wasm/office2pdf_wasm.js'); for (const file of ['office2pdf_wasm_bg.wasm','office2pdf_wasm.d.ts','office2pdf_wasm_bg.wasm.d.ts']) fs.copyFileSync('wasm/pkg/'+file, 'dist/wasm/'+file)\"","bin:chmod":"node -e \"require('node:fs').chmodSync('dist/cli.js', 0o755)\"","format":"prettier --write .","format:check":"prettier --check .","check":"npm run typecheck && npm run test && npm run test:real && npm run format:check"},"devDependencies":{"@types/node":"^22.10.2","prettier":"^3.4.2","typescript":"^5.7.3","vitest":"^2.1.8"},"gitHead":"e5796f14d8b1d66a3e6a0773d5d29b9cca5ce434","_id":"@alexsun-top/office2pdf@0.1.1","bugs":{"url":"https://github.com/agentsyaml/office2pdf-ts/issues"},"homepage":"https://github.com/agentsyaml/office2pdf-ts#readme","_nodeVersion":"22.22.3","_npmVersion":"11.17.0","dist":{"integrity":"sha512-2qsbrA34h9Ieaje5XmXlPxYmqhxc145QNzJ2w0pbiEGSi1G1eZfDXUiH95gAxyfZq6NUIdmGlavEXGaoij23vg==","shasum":"7996d0c512afcd5d752f41b334e5acc5b19b4e68","tarball":"https://registry.npmjs.org/@alexsun-top/office2pdf/-/office2pdf-0.1.1.tgz","fileCount":24,"unpackedSize":50256408,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alexsun-top%2foffice2pdf@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFW3Ba9nZWMTPdAHQPG31gKTR88Blh6pXJb2PFTa1agxAiEAtnxNeKXfgFyB4TjpgINK/3iSw8m0dfZ28KTwZu9ENRE="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:a752d632-51d9-4ce1-92ba-92bfeec2d5d9"}},"directories":{},"maintainers":[{"name":"alexsun-top","email":"6a6l6e6x@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/office2pdf_0.1.1_1782295020952_0.700623221811109"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-11T07:25:18.721Z","modified":"2026-06-24T09:57:01.668Z","0.1.0":"2026-06-11T07:25:19.317Z","0.1.1":"2026-06-24T09:57:01.343Z"},"license":"Apache-2.0","description":"Node-first TypeScript bindings for office2pdf via Rust/WASM.","maintainers":[{"name":"alexsun-top","email":"6a6l6e6x@gmail.com"}],"readme":"# @alexsun-top/office2pdf\n\nNode-first TypeScript binding for [`office2pdf = \"0.6\"`](https://docs.rs/office2pdf/0.6.0/office2pdf/) via a generated WebAssembly bridge.\n\n- No LibreOffice service\n- No Chromium/Docker/browser-only wrappers\n- No Python/CLI dependency\n\n## Install\n\n```bash\nnpm install @alexsun-top/office2pdf\n```\n\n## Usage\n\n```ts\nimport {\n  convertBytes,\n  convertDocxToPdf,\n  convertPath,\n  convertToPdf,\n  inferFormat,\n  __version__,\n  Format,\n} from \"@alexsun-top/office2pdf\";\nimport { writeFile } from \"node:fs/promises\";\n\n// infer extension before conversion\nconst format = inferFormat(\"/tmp/report.docx\"); // \"docx\"\n\n// convert local file\nconst result = await convertPath(\"/tmp/report.docx\");\nawait writeFile(\"/tmp/report.pdf\", result.pdf);\n\n// convert bytes\nconst input = new Uint8Array([\n  /* office file bytes */\n]);\nconst { pdf, warnings, metrics } = await convertBytes(input, Format.DOCX, {\n  includeWarnings: true,\n  paperSize: \"A4\",\n});\n\n// upstream-compatible JS/WASM helper style: returns PDF bytes only\nconst helperPdf = await convertDocxToPdf(input);\nconst genericPdf = await convertToPdf(input, \"docx\");\n```\n\n### API\n\n- `__version__: string`\n- `Format: { DOCX: \"docx\"; PPTX: \"pptx\"; XLSX: \"xlsx\"; docx: \"docx\"; pptx: \"pptx\"; xlsx: \"xlsx\" }`\n- `inferFormat(pathOrUrl: string | URL): \"docx\" | \"pptx\" | \"xlsx\"`\n- `convertBytes(data, format, options?)`\n- `convertPath(pathOrUrl, options?)`\n- `convertToPdf(data, format)` -> `Promise<Uint8Array>`\n- `convertDocxToPdf(data)` -> `Promise<Uint8Array>`\n- `convertPptxToPdf(data)` -> `Promise<Uint8Array>`\n- `convertXlsxToPdf(data)` -> `Promise<Uint8Array>`\n\n`ConvertOptions` accepts both camelCase and snake_case aliases:\n\n- `sheetNames` / `sheet_names`\n- `sheetFilter` / `sheet_filter` compatibility alias for `sheet_names`\n- `slideRange` / `slide_range`\n- `paperSize` / `paper_size`\n- `fontPaths` / `font_paths`\n- `pdfStandard` / `pdf_standard`\n- `includeWarnings` / `include_warnings`\n- `pdfUa` / `pdf_ua`\n- `streamingChunkSize` / `streaming_chunk_size`\n\nIt also accepts upstream boolean options `tagged` and `streaming`.\n\nRust-native upstream APIs map to this Node package as follows:\n\n- `office2pdf::convert(path)` and `convert_with_options(path, options)` correspond to `convertPath(path, options?)`.\n- `office2pdf::convert_bytes(data, format, options)` corresponds to `convertBytes(data, format, options?)`.\n- `render_document` is not exposed because this package does not expose the upstream IR document model.\n\nUnsupported by upstream `office2pdf 0.6`:\n\n- `pageRange` / `page_range` -> throws\n  - `page_range is not supported by upstream office2pdf 0.6`\n- `memoryLimitMb` / `memory_limit_mb` -> throws\n  - `memory_limit_mb is not supported by upstream office2pdf 0.6`\n\n#### Result shape\n\n```ts\n{\n  pdf: Uint8Array;\n  warnings: string[];\n  metrics: null | {\n    parseDurationMs: number;\n    codegenDurationMs: number;\n    compileDurationMs: number;\n    totalDurationMs: number;\n    inputSizeBytes: number;\n    outputSizeBytes: number;\n    pageCount: number;\n  };\n}\n```\n\n## CLI\n\nBuild exports a `office2pdf` command:\n\n```bash\noffice2pdf --help\noffice2pdf --version\noffice2pdf input.docx output.pdf\noffice2pdf input.docx -o output.pdf\noffice2pdf input.xlsx --outdir ./pdfs\noffice2pdf --paper A4 --landscape --pdf-a input.docx output.pdf\noffice2pdf --sheets Sheet1,Sheet2 input.xlsx output.pdf\noffice2pdf --slides 1-3 input.pptx output.pdf\noffice2pdf --font-path /path/font-a.ttf --font-path /path/font-b.ttf input.docx output.pdf\n```\n\nSupported flags: `-o` / `--output`, `--outdir`, `--paper`, `--landscape`, `--pdf-a`, `--sheets`, `--slides`, and repeatable or comma-separated `--font-path`.\n\n## Scripts\n\n- `npm run wasm:build` — build wasm artifacts to `wasm/pkg`\n- `npm run build` — build wasm (release), copy publishable wasm files, and compile TypeScript\n- `npm run typecheck` — TypeScript typecheck\n- `npm test` — run Vitest\n- `npm run check` — typecheck + tests + format check\n\n## Development\n\n- Rust crate: `rust/`\n- TypeScript entrypoints: `src/index.ts`, `src/cli.ts`, `src/native.ts`\n- Tests: `tests/index.test.ts`, `tests/cli.test.ts`, `tests/real-conversion.test.ts`\n\n## Release\n\nGitHub Actions runs package checks on every branch push and pull request. The\npublish workflow runs only when a version tag matching `v*.*.*` is pushed, for\nexample `v0.1.0`.\n\nThe npm package name is `@alexsun-top/office2pdf`. For the first manual public\npublish of this scoped package, run the same local checks and publish with\nexplicit public access:\n\n```bash\nnpm ci\nnpm run check\nnpm run build\nnpm publish --access public\n```\n\nDo not create or push a release tag until the target npm version, exact tag name,\nremote push target, and publish path have been explicitly approved.\n\nThe publish workflow is designed for npm Trusted Publishing with GitHub Actions\nOIDC. To enable automatic npm authentication without long-lived tokens:\n\n1. Open the package settings on npmjs.com.\n2. Add a trusted publisher for `agentsyaml/office2pdf-ts`.\n3. Set the trusted workflow file to `.github/workflows/publish.yml`.\n4. Allow the workflow to run `npm publish --access public`.\n\nThe workflow grants `id-token: write`, so npm can exchange the GitHub OIDC token\nduring `npm publish --access public`. No `NPM_TOKEN` secret is required for this\npath, and no generated `dist/` or `wasm/pkg/` files need to be committed.\n\nIf Trusted Publishing is unavailable, create an npm automation token, store it\nas the GitHub Actions secret `NPM_TOKEN`, configure `actions/setup-node` with\n`registry-url: https://registry.npmjs.org`, and pass the secret only to the\npublish step as `NODE_AUTH_TOKEN`. Never commit token values.\n","readmeFilename":"README.md","homepage":"https://github.com/agentsyaml/office2pdf-ts#readme","repository":{"type":"git","url":"git+https://github.com/agentsyaml/office2pdf-ts.git"},"bugs":{"url":"https://github.com/agentsyaml/office2pdf-ts/issues"}}