Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .difyignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@ __pycache__

.venv

# Ignore all GitHub metadata from Dify processing (issue templates, workflows, actions, configs)
.github/
.claude

TODO.md

.github/

.gitignore

.ruff_cache
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Lint

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Run ruff check
run: uvx ruff check .

- name: Run ruff format check
run: uvx ruff format --check .

- name: Run mdformat check
run: uvx mdformat --check --number .
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ __pycache__
.DS_Store

.venv

.claude

.ruff_cache
62 changes: 62 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
MIT License

Copyright (c) 2025 dify-pdf-process-plugin contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

================================================================================
THIRD-PARTY LICENSES
================================================================================

This project depends on the following third-party libraries, each subject to
their own license terms:

1. dify_plugin
License: Apache License 2.0
https://pypi.org/project/dify_plugin/

2. PyMuPDF
License: GNU Affero General Public License v3.0 (AGPL-3.0) OR Commercial License
https://pymupdf.readthedocs.io/

IMPORTANT: PyMuPDF is dual-licensed:
- Open source projects: AGPL-3.0 (requires your project to be open source)
- Commercial/proprietary use: Requires commercial license from Artifex Software

If you use this project in a commercial or proprietary application, you must
either comply with AGPL-3.0 terms or obtain a commercial license for PyMuPDF
from Artifex Software, Inc. (https://artifex.com/)

3. Pillow
License: MIT-CMU License (Historical PIL License)
https://pillow.readthedocs.io/

For the complete license text of each dependency, please refer to their
respective package documentation and license files.

================================================================================
LICENSE COMPLIANCE NOTICE
================================================================================

Users of this software must ensure compliance with all third-party licenses,
particularly the AGPL-3.0 requirements of PyMuPDF. The AGPL-3.0 license may
impose additional obligations on your project depending on your use case.

For questions about licensing compliance, please consult with a legal
professional or contact the respective library maintainers.
3 changes: 2 additions & 1 deletion PRIVACY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This plugin processes PDF files you provide to extract, manipulate content, and
## Not Collected

No personal information is collected or stored, including:

- Names or contact details
- Login credentials
- Device information
Expand All @@ -30,4 +31,4 @@ No personal information is collected or stored, including:

## Your Control

You control what PDFs you provide and can stop using the plugin at any time.
You control what PDFs you provide and can stop using the plugin at any time.
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,57 +15,83 @@ PDF Process is a collection of powerful tools designed to perform various PDF op
- PDF to PNG conversion with adjustable quality

## Important Note

All page numbers in this plugin are 1-indexed, meaning the first page of any PDF is page 1, the second is page 2, and so on.

## Available Tools

### 1. PDF Single Page Extractor

Extracts a specific page from a PDF file and saves it as a new PDF.

Parameters:

- **PDF Content**: The input PDF file (required)
- **Page Number**: The specific page to extract (1-indexed, where page 1 is the first page, required)

![PDF Single Page Extractor Interface](./_assets/pdf_single_page_extractor.png)

### 2. PDF Multi Pages Extractor

Extracts specified pages from a PDF file. Supports flexible page specifications like ranges ("1-3"), individual pages ("1,2,3"), or combinations ("1-3,5"). Optionally includes a set of fixed pages before the dynamic pages. The order of pages and any duplicates specified in the input strings are preserved in the output PDF.

Parameters:

- **PDF Content**: The input PDF file (required).
- **Fixed Pages**: Optional string specifying fixed pages to include at the beginning (1-indexed). Examples: `"1-3"`, `"5"`, `"1,3,5-7"`, `"1,3,1-2"`. Order and duplicates are preserved. Leave empty if none (default: `""`).
- **Dynamic Pages**: Required string specifying the dynamic pages to extract (1-indexed). Examples: `"1-3"`, `"5"`, `"1,3,5-7"`, `"1,3,1-2"`. Order and duplicates are preserved (default: `"1"`).

![PDF Multi Pages Extractor Interface](./_assets/pdf_multi_pages_extractor.png)

### 3. PDF Page Counter
Counts the total number of pages in a PDF file with customizable output format.

Counts the total number of pages in a PDF file.

Parameters:

- **PDF Content**: The input PDF file (required)
- **Output Format**: Choose between 'number' or 'json' format (optional, defaults to 'number')

![PDF Page Counter Interface](./_assets/pdf_page_counter.png)

### 4. PDF Splitter

Splits a PDF file into multiple individual PDF files, creating a separate file for each page.

Parameters:

- **PDF Content**: The input PDF file (required)

![PDF Splitter Interface](./_assets/pdf_splitter.png)

### 5. PDF to PNG Converter

Converts each page of a PDF file into high-quality PNG images with configurable zoom settings.

Parameters:

- **PDF Content**: The input PDF file (required)
- **Zoom Factor**: Quality control zoom factor (optional, defaults to 2)

![PDF to PNG Converter Interface](./_assets/pdf_to_png.png)

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

### Third-Party Dependencies

This project uses the following third-party libraries:

- **dify_plugin** - Apache License 2.0
- **PyMuPDF** - AGPL-3.0 OR Commercial License
- **Pillow** - MIT-CMU License

**Important**: PyMuPDF is dual-licensed under AGPL-3.0 for open source projects or requires a commercial license for proprietary use. Please review the [LICENSE](LICENSE) file for complete licensing information and compliance requirements.

## Author

Created by [Kalo Chin](https://github.com/fdb02983rhy)

## Repository
https://github.com/fdb02983rhy/dify-pdf-process-plugin

https://github.com/fdb02983rhy/dify-pdf-process-plugin
Loading