Skip to content

v3.0.0 - Safer invoice renaming and complete A4 merges

Latest

Choose a tag to compare

@qingfpc qingfpc released this 30 Sep 18:17

v3.0.0 — Safer invoice renaming and complete A4 merges

中文说明

本版本修复误重命名、金额解析错误、多页遗漏、重复合并与输出覆盖问题。Windows 用户请下载本次 Release 的 EXE,旧版本附件不会随源码更新。

  • 无法识别的 PDF 和缺少命名字段的发票保留原名,报告原因,不再生成“未知”或伪造零金额的文件名。
  • 正确处理负数和千分位金额,保留完整名称及带空格的字段标签;重名序号在重复运行时保持稳定。
  • 两个合并入口处理每份 PDF 的所有页面,以 216 DPI 渲染可见内容和注释,上下两页排版到 A4。
  • 跳过已有合集,接受输出目录或完整 PDF 文件名,创建缺失目录,保护已有输出。
  • 部分失败明确报告遗漏;没有可用页面时不生成空白 PDF,也不报告合并成功。
  • 更新中英文 README、固定依赖、测试和 Windows 打包脚本,并补齐源码及依赖许可说明。

下载与使用

附件 用途
InvoiceHelper_AllInOne.exe 全功能:按提示选择是否重命名及合并
InvoiceRenamer_Only.exe 仅重命名
InvoiceMerger_Only.exe 仅合并,扫描件也可用于打印
SHA256SUMS.txt 附件的 SHA-256 校验值
THIRD_PARTY_LICENSES.zip 打包组件的原始许可文本、版权说明和源码参考

三个程序适用于 Windows 64 位,无需另装 Python。源码和安装、测试、打包步骤见本版本标签下的 README。

兼容性变化与限制

Python 调用方需要适配:extract_invoice_data() 对无法识别的文件返回 None,可识别发票中的缺失字段也是 None。格式化文件名之前检查所需字段。不要继续依赖旧版占位符或零金额。

合并结果为图片,文字不能选中或搜索;请保留原始发票用于归档。合并不会检查 PDF 是否为发票,请将待打印文件放在单独目录。重命名只读第一页、没有 OCR,特殊发票模板仍需核对识别结果。合并程序打包了使用 AGPLv3 开源许可的 PyMuPDF/MuPDF,详见许可附件。

验证

在 Windows 11、Python 3.12.13 上通过 35 项源码 PDF/命令行回归测试,以及 5 项流程测试(覆盖三个 EXE 和可复用 Python 命令行入口)。测试使用生成的真实 PDF 文件,执行读写、解析、渲染及独立进程;覆盖多页、注释、扫描件、损坏/加密文件、重复运行和输出保护。生成样例不代表所有个人发票模板均已验证。

English notes

This release fixes incorrect renames, amount parsing, missing pages, repeated bundle inclusion, and output protection. Windows users should download the EXEs attached to this release; older binaries do not update with the source.

  • Preserve original names for unrecognized PDFs and invoices missing required fields. Report reasons instead of creating placeholder names or fabricated zero amounts.
  • Parse negative and grouped amounts correctly, retain complete names and spaced labels, and keep collision suffixes stable across repeat runs.
  • Process every page through both merger entry points, rendering visible content and annotations at 216 DPI into two-up A4 sheets.
  • Skip existing bundles, accept directories or full output filenames, create missing directories, and preserve existing outputs.
  • Report partial omissions explicitly. Produce no blank PDF or success message when no pages are usable.
  • Update both READMEs, pinned dependencies, tests, Windows builds, and source/dependency license notices.

Downloads

Asset Purpose
InvoiceHelper_AllInOne.exe Choose whether to rename and merge
InvoiceRenamer_Only.exe Rename only
InvoiceMerger_Only.exe Merge only, including scanned pages for printing
SHA256SUMS.txt SHA-256 checksums for the attachments
THIRD_PARTY_LICENSES.zip Original component licenses, copyright notices, and source references

The three EXEs run on 64-bit Windows without a separate Python installation. Source, setup, tests, and build commands are available in the README at this release tag.

Compatibility and limits

Python callers must handle the new return values: extract_invoice_data() returns None for unrecognized documents, and missing fields on recognized invoices are also None. Validate required fields before formatting filenames; do not rely on old placeholder strings or zero amounts.

Merged output consists of images, with no selectable or searchable text. Retain original invoices for archiving. Merging accepts readable PDFs without verifying they are invoices; use a separate input folder. Renaming reads the first page and has no OCR. Check recognition results for unusual templates. The merger EXEs include PyMuPDF/MuPDF under their open-source AGPLv3 license; see the license attachment.

Validation

Passed 35 source PDF/CLI regression tests and 5 process tests covering all three EXEs and the reusable Python CLI on Windows 11 with Python 3.12.13. Tests create actual PDF files and perform parsing, rendering, file operations, and subprocess execution. Coverage includes multiple pages, annotations, scans, corrupt/encrypted documents, repeat runs, and output protection. Generated samples do not establish compatibility with every personal invoice template.