Repository navigation
Releases: qingfpc/PDF-Invoice-Renamer
Release list
v3.0.0 - Safer invoice renaming and complete A4 merges
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.
v2.0.1 - Robust Rendering for New Digital Invoices (Full-Tax Stamps Support)
🚀 What's New / 更新内容
- Fix: Invoice Stamp Loss: Completely resolved the issue where electronic stamps and icons would disappear after merging, especially for the latest Full-Digital Electronic Invoices.
- 修复:发票印章丢失:彻底解决了合并后红色监制章、发票章消失的问题,完美支持最新的全电发票(数字化电子发票)。
- High-Definition Rendering: Switched to a high-resolution rasterization rendering logic (3.0x zoom / ~216 DPI) to ensure 100% visual fidelity for financial reimbursement.
- 高清渲染技术:引入高清位图渲染逻辑(3.0 倍率 / 约 216 DPI),确保 100% 视觉还原,满足财务报销打印的清晰度要求。
- Layout Optimization: Refined A4 coordinate calculations with added safety margins to prevent content from being clipped by printers.
排版逻辑优化:精细化 A4 页面坐标计算,增加了安全边距,防止发票边缘内容在打印时被裁切。
📦 Included Executables / 包含的程序说明
To provide a complete toolset, we have re-packaged and uploaded all three tools. It is highly recommended to use the latest v2.0.1 versions.
为了提供完整的工具集,我们重新打包并上传了所有三个工具。强烈建议使用最新的 v2.0.1 版本。
- InvoiceHelper_AllInOne_v2.0.1.exe (Recommended/推荐):
- The full-featured master tool (Rename + Merger) with the new robust rendering engine.
- 包含重命名与合并完整流程的全功能主程序,已集成最新的强力渲染引擎。
2.InvoiceMerger_Only_v2.0.1.exe: - Updated with the new rendering logic to fix stamp loss during merging.
- 仅合并工具,已更新渲染逻辑以修复印章丢失问题。
3.InvoiceRenamer_Only_v2.0.1.exe: - Re-uploaded for version consistency (Internal logic remains same as v2.0.0).
- 仅重命名工具,为保持版本一致性重新上传(逻辑同 v2.0.0)。
🛠 Technical Note / 技术说明
This update addresses a known limitation in PDF vector merging where Optional Content Groups (OCG) or transparency masks used in digital invoices were lost. The new version renders each page as a high-fidelity image before placement. 本次更新解决了 PDF 矢量合并中的局限性(即全电发票使用的 OCG 图层或透明度掩模在合并时会失效的问题)。新版本在排版前会将每一页渲染为高保真图像,实现“所见即所得”。
v2.0.0 - All-in-One Invoice Helper (Rename & Layout Merger)
🚀 What's New
- New Feature: A4 Layout Merger: Introduced an intelligent merging tool that arranges two invoices onto a single A4 page (2-up), significantly saving paper for printing.
- Integrated Workflow: Added a master script that allows users to perform both renaming and merging tasks in one go.
- Improved Extraction: Enhanced text parsing logic for better recognition of seller names and total amounts.
- Multi-language Support: Added English versions for the README and documentation.
📦 Included Executables
To meet different user needs, we have provided three separate tools in this release:
- InvoiceHelper_AllInOne.exe (Recommended): The full-featured master tool for a complete workflow.
- InvoiceRenamer_Only.exe: Dedicated tool for automatic file renaming only.
- InvoiceMerger_Only.exe: Dedicated tool for A4 layout and PDF merging only.
🚀 更新内容
- 新增功能:A4 排版合并:引入了智能拼版功能,支持将两张发票自动排版至一张 A4 纸(上下排列),大幅节省打印纸张。
- 整合工作流:新增全功能主程序,支持一次性完成重命名与合并任务。
- 识别优化:改进了提取逻辑,提升了对销售方名称和合计金额的识别准确率。
- 多语言支持:新增了英文版的 README 和文档说明。
📦 包含的程序说明
本次发布包含三个独立的工具,以满足不同使用场景:
- InvoiceHelper_AllInOne.exe (推荐):全功能合集,支持重命名+合并完整流程。
- InvoiceRenamer_Only.exe:仅进行发票自动重命名。
- InvoiceMerger_Only.exe:仅进行 A4 拼版与 PDF 合并。
v1.0.1 - 电子发票自动重命名工具
v1.0.1
- 修复 build/dist 冗余文件问题
- 更新 README.md 下载链接
- 修正版本号内置为 1.0.1
v1.0.0 - 电子发票自动重命名工具 (初始发布)
🎉 初始版本 (Initial Release)
这是 Invoice Renamer 的第一个正式稳定版本。如果你需要批量整理混乱的 PDF 电子发票文件名,这个工具可以帮助你自动化处理。
✨ 主要功能 (Features)
- 智能解析:自动识别 PDF 发票中的发票代码、号码、开票日期、金额及销售方名称。
- 批量处理:支持指定文件夹,一键处理成百上千个文件。
- 自定义格式:内置 4 种常用命名格式(如
20231201_京东_299.00.pdf)。 - 无需配置:单文件绿色版,无需安装 Python 环境,下载即用。
📦 如何使用 (Usage)
- 下载下方的
InvoiceRenamer.exe文件(在 Assets 区域)。 - 双击运行程序。
- 按照屏幕提示输入发票所在的文件夹路径。
- 选择你喜欢的重命名格式,回车即可。
注意:目前主要支持中国标准增值税电子普通/专用发票(PDF格式)。