PDF2excel/README.md

90 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# PDF 银行流水转 Excel 工具
这是一个 Node.js 命令行工具,用于将银行 PDF 流水文件转换为 Excel 文件。
## 功能概述
- 解析 PDF 银行流水文件,提取交易记录。
- 将提取的交易记录转换为 Excel 格式。
- 支持自定义输出 Excel 文件名。
## 依赖项
- dayjs
- pdf2json
- node-xlsx
- yargs
## 如何使用
1. **安装依赖项:**
```bash
npm install
```
2. **运行工具:**
```bash
node index.js -i <input.pdf> [-o <output.xlsx>]
```
- `-i <input.pdf>`:指定输入的 PDF 文件名(必需)。
- `-o <output.xlsx>`:指定输出的 Excel 文件名(可选,默认为 `transactions.xlsx`)。
例如:
```bash
node index.js -i bank_statement.pdf -o transactions.xlsx
```
3. **构建项目(可选):**
如果您使用 TypeScript 并且需要构建项目,请运行:
```bash
npm run build
```
然后,您可以使用以下命令运行构建后的 JavaScript 文件:
```bash
node ./dist/index.js -i <input.pdf> [-o <output.xlsx>]
```
## 项目结构
```
项目根目录/
├── index.js # 主入口文件
├── package.json # 项目配置文件
├── README.md # 项目说明文档
└── ... # 其他文件
```
## 注意事项
- 该工具仅适用于特定格式的银行 PDF 流水文件。如果您的 PDF 文件格式不同,可能需要修改代码中的正则表达式和交易类型列表。
- 如果 PDF 文件包含加密或复杂的布局,解析可能会失败。
## 贡献
欢迎贡献代码!请按照以下步骤:
1. Fork 本仓库。
2. 创建你的 Feature Branch (`git checkout -b feature/YourFeature`)。
3. 提交你的修改 (`git commit -m 'Add some YourFeature'`)。
4. 推送到远程分支 (`git push origin feature/YourFeature`)。
5. 发起 Pull Request。
## 许可证
[请在此处添加你的项目许可证,例如 MIT、Apache 2.0 等]
## 作者
[请在此处添加你的姓名或组织名称]
## 联系方式
[请在此处添加你的联系方式例如邮箱、GitHub 链接等]