Skip to content

Commit

Permalink
支持跨平台
Browse files Browse the repository at this point in the history
update ci

update

update ci

update ci

update ci

update

update ci

update ci

update

update

update

update

update

update

update

update

update

update

update

update

update

update

update

update

update

update

update

update

update

update

update

update

update font

update

update

update
  • Loading branch information
kevin2li committed Jul 15, 2023
1 parent fbccc46 commit da88d8e
Show file tree
Hide file tree
Showing 24 changed files with 13,415 additions and 928 deletions.
76 changes: 0 additions & 76 deletions .circleci/config.yml

This file was deleted.

135 changes: 122 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ run-name: ${{ github.actor }}
on:
push:
branches:
- main
- dev
jobs:
deploy-macos:
runs-on: macos-latest
Expand All @@ -19,28 +19,137 @@ jobs:
node-version: 18

- name: 安装 Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.20.5

- name: 安装 Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.10
python-version: 3.10.11

- name: 编译
- name: 安装依赖 && 编译
run: |
ROOT=$(pwd)
mkdir -p ${ROOT}/build/bin
go install github.com/wailsapp/wails/v2/cmd/wails@latest
go mod tidy
cd frontend
cd ${ROOT}/frontend
npm install
cd ${ROOT}/thirdparty
pip install -r requirements.txt
pyinstaller -F -w pdf.py
cp dist/pdf ${ROOT}/build/bin/
cp ocr.py convert.py ${ROOT}/build/bin/
cd $ROOT
brew install upx
wails build -upx -ldflags "-s -w"
- name: 上传Artifacts
uses: actions/upload-artifact@v3
with:
name: pdf-guru-darwin-amd64
path: build/bin

deploy-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 安装 Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: 安装 Go
uses: actions/setup-go@v4
with:
go-version: 1.20.5

- name: 安装 Python
uses: actions/setup-python@v4
with:
python-version: 3.10.11

- name: 安装依赖 && 编译
run: |
$ROOT=$(pwd)
mkdir -p ${ROOT}\build\bin
go install github.com/wailsapp/wails/v2/cmd/wails@latest
go mod tidy
cd ${ROOT}\frontend
npm install
cd ../third_party
cd ${ROOT}\thirdparty
pip install -r requirements.txt
pyinstaller -F -w pdf.py
cp dist/pdf.exe ${ROOT}\build\bin\
cp ocr.py ${ROOT}\build\bin\
cp convert.py ${ROOT}\build\bin\
cd $ROOT
choco install -y upx
wails build -upx
- name: 上传Artifacts
uses: actions/upload-artifact@v3
with:
name: pdf-guru-windows-amd64
path: build/bin

deploy-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 安装 Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: 安装 Go
uses: actions/setup-go@v4
with:
go-version: 1.20.5

- name: 安装 Python
uses: actions/setup-python@v4
with:
python-version: 3.10.11

- name: 安装依赖 && 编译
run: |
ROOT=$(pwd)
mkdir -p ${ROOT}/build/bin
go install github.com/wailsapp/wails/v2/cmd/wails@latest
go mod tidy
cd ${ROOT}/frontend
npm install
cd ${ROOT}/thirdparty
pip install -r requirements.txt
cd ..
wails build
pyinstaller -F -w pdf.py
cp dist/pdf ${ROOT}/build/bin/
cp ocr.py convert.py ${ROOT}/build/bin/
cd $ROOT
sudo apt-get update
sudo apt-get install libgtk-3-dev libwebkit2gtk-4.0-dev build-essential upx
wails build -upx -ldflags "-s -w"
- name: 部署Artifacts
uses: JamesIves/github-pages-deploy-action@v4
- name: 上传Artifacts
uses: actions/upload-artifact@v3
with:
branch: release
folder: build/bin
name: pdf-guru-linux-amd64
path: build/bin
53 changes: 37 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- 编译安装
1. 安装[go](https://go.dev/dl/)环境和[node](https://nodejs.org/en/download/)环境和[python](https://docs.conda.io/en/latest/miniconda.html)环境
1. 安装[go](https://go.dev/dl/)环境、[node](https://nodejs.org/en/download/)环境和[python](https://docs.conda.io/en/latest/miniconda.html)环境
```bash
# 确认go安装成功
Expand All @@ -63,36 +63,41 @@ echo $PATH | grep go/bin

# 确认nodejs安装成功
npm --version

# 安装pnpm
npm install -g pnpm
```
2. 编译项目
```bash
git clone https://github.com/kevin2li/PDF-Guru.git
cd PDF-Guru
ROOT=$(pwd)
go install github.com/wailsapp/wails/v2/cmd/wails@latest
go mod tidy
# 安装前端依赖
cd frontend
pnpm install
cd ${ROOT}/frontend
npm install
# 安装后端环境
cd thirdparty
cd ${ROOT}/thirdparty
pip install pymupdf reportlab pillow loguru pyinstaller
pyinstaller -F -w pdf.py
mkdir ${ROOT}/build/bin
# 1) for darwin, linux
cp dist/pdf ocr.py convert.py ${ROOT}/build/bin
cd .. # 切到根目录
# 2) for windows
cp dist/pdf.exe ${ROOT}/build/bin
cp ocr.py ${ROOT}/build/bin
cp convert.py ${ROOT}/build/bin
cd $ROOT
wails dev # 开发预览
wails build # 编译
```
windows:

`pdf.exe``PDF Guru.exe``ocr.py``convert.py`放在一个文件夹下,运行`PDF Guru.exe`即可。
`build/bin`目录打包,运行`PDF Guru`即可。

<details close>
<summary><h4>额外安装(可选)</h4></summary>
Expand Down Expand Up @@ -122,11 +127,24 @@ pip install "paddleocr>=2.0.1"

3. 查看环境中python解释器路径

可以通过`conda env list`命令查看`ocr`环境的绝对路径,如:`C:\Users\{用户名}\miniconda3\envs\ocr\`
可以通过`conda env list`命令查看`ocr`环境的绝对路径, 注意下面的`{用户名}`请根据自己实际情况进行替换。

- windows

如:`C:\Users\{用户名}\miniconda3\envs\ocr\`
则python解释器路径为:`C:\Users\{用户名}\miniconda3\envs\ocr\python.exe`

1. 在PDF Guru的“首选项”中配置装有paddleocr的python路径
- Mac

如:`/Users/{用户名}/miniconda3/envs/ocr`
则python解释器路径为:`/Users/{用户名}/miniconda3/envs/ocr/bin/python`

- Linux

如:`/home/{用户名}/miniconda3/envs/ocr`
则python解释器路径为:`/home/{用户名}/miniconda3/envs/ocr/bin/python`

4. 在PDF Guru的“首选项”中配置装有paddleocr的python路径

![首选项](assets/settings.png)

Expand Down Expand Up @@ -158,13 +176,16 @@ https://pandoc.org/installing.html

3. 路径格式

全部使用绝对路径,类似:`C:\Users\kevin\Downloads\test.txt`
全部使用绝对路径,类似:`C:\Users\kevin\Downloads\test.txt`, 注意不要用引号包裹路径

Windows下可以选中目标文件后使用`Ctrl+Shift+C`快速复制文件绝对路径。
> 如何快速获取文件绝对路径?
> 1. Windows下可以选中目标文件后使用`Ctrl+Shift+C`快速复制文件绝对路径。
> 2. MacOS下可以选中目标文件后使用`Command+Opion+C`快速复制文件绝对路径。
软件会自动检测路径是否存在,不合法的路径将不会被通过,也不会进行继续的处理。

如果想批量操作,可以使用通配符`*`。例如批量对PDF文件进行旋转,路径可以填`C:\Users\kevin\Downloads\*.pdf`,将会匹配`C:\Users\kevin\Downloads`目录下所有的PDF文件。除少数功能(插入/替换等)外,大部分都支持批量操作。
如果想批量操作,可以使用通配符`*`
例如批量对PDF文件进行旋转,路径可以填`C:\Users\kevin\Downloads\*.pdf`,将会匹配`C:\Users\kevin\Downloads`目录下所有的PDF文件。除少数功能(插入/替换等)外,大部分都支持批量操作。

4. 坐标

Expand Down
Loading

0 comments on commit da88d8e

Please sign in to comment.