lightpdf-aipdf-mcp 0.1.54__py3-none-any.whl → 0.1.55__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lightpdf_aipdf_mcp/converter.py +0 -10
- lightpdf_aipdf_mcp/editor.py +22 -0
- lightpdf_aipdf_mcp/server.py +37 -1
- {lightpdf_aipdf_mcp-0.1.54.dist-info → lightpdf_aipdf_mcp-0.1.55.dist-info}/METADATA +3 -5
- lightpdf_aipdf_mcp-0.1.55.dist-info/RECORD +9 -0
- lightpdf_aipdf_mcp-0.1.54.dist-info/RECORD +0 -9
- {lightpdf_aipdf_mcp-0.1.54.dist-info → lightpdf_aipdf_mcp-0.1.55.dist-info}/WHEEL +0 -0
- {lightpdf_aipdf_mcp-0.1.54.dist-info → lightpdf_aipdf_mcp-0.1.55.dist-info}/entry_points.txt +0 -0
lightpdf_aipdf_mcp/converter.py
CHANGED
@@ -17,8 +17,6 @@ class InputFormat(str, Enum):
|
|
17
17
|
JPG = "jpg"
|
18
18
|
JPEG = "jpeg"
|
19
19
|
PNG = "png"
|
20
|
-
BMP = "bmp"
|
21
|
-
GIF = "gif"
|
22
20
|
CAD = "dwg"
|
23
21
|
CAJ = "caj"
|
24
22
|
OFD = "ofd"
|
@@ -32,8 +30,6 @@ class OutputFormat(str, Enum):
|
|
32
30
|
JPG = "jpg"
|
33
31
|
JPEG = "jpeg"
|
34
32
|
PNG = "png"
|
35
|
-
BMP = "bmp"
|
36
|
-
GIF = "gif"
|
37
33
|
HTML = "html"
|
38
34
|
TEXT = "txt"
|
39
35
|
|
@@ -46,8 +42,6 @@ INPUT_EXTENSIONS = {
|
|
46
42
|
".jpg": InputFormat.JPG,
|
47
43
|
".jpeg": InputFormat.JPEG,
|
48
44
|
".png": InputFormat.PNG,
|
49
|
-
".bmp": InputFormat.BMP,
|
50
|
-
".gif": InputFormat.GIF,
|
51
45
|
".dwg": InputFormat.CAD,
|
52
46
|
".caj": InputFormat.CAJ,
|
53
47
|
".ofd": InputFormat.OFD,
|
@@ -62,8 +56,6 @@ FORMAT_CONVERSION_MAP = {
|
|
62
56
|
OutputFormat.JPG, # PDF转JPG
|
63
57
|
OutputFormat.JPEG, # PDF转JPEG
|
64
58
|
OutputFormat.PNG, # PDF转PNG
|
65
|
-
OutputFormat.BMP, # PDF转BMP
|
66
|
-
OutputFormat.GIF, # PDF转GIF
|
67
59
|
OutputFormat.HTML, # PDF转HTML
|
68
60
|
OutputFormat.TEXT, # PDF转文本
|
69
61
|
},
|
@@ -73,8 +65,6 @@ FORMAT_CONVERSION_MAP = {
|
|
73
65
|
InputFormat.JPG: {OutputFormat.PDF}, # JPG转PDF
|
74
66
|
InputFormat.JPEG: {OutputFormat.PDF}, # JPEG转PDF
|
75
67
|
InputFormat.PNG: {OutputFormat.PDF}, # PNG转PDF
|
76
|
-
InputFormat.BMP: {OutputFormat.PDF}, # BMP转PDF
|
77
|
-
InputFormat.GIF: {OutputFormat.PDF}, # GIF转PDF
|
78
68
|
InputFormat.CAD: {OutputFormat.PDF}, # CAD转PDF
|
79
69
|
InputFormat.CAJ: {OutputFormat.PDF}, # CAJ转PDF
|
80
70
|
InputFormat.OFD: {OutputFormat.PDF}, # OFD转PDF
|
lightpdf_aipdf_mcp/editor.py
CHANGED
@@ -19,6 +19,7 @@ class EditType(str, Enum):
|
|
19
19
|
ENCRYPT = "protect" # 加密PDF
|
20
20
|
DECRYPT = "unlock" # 解密PDF
|
21
21
|
ADD_WATERMARK = "watermark" # 添加水印
|
22
|
+
REMOVE_MARGIN = "edit" # 去除白边
|
22
23
|
|
23
24
|
@dataclass
|
24
25
|
class EditResult(BaseResult):
|
@@ -354,6 +355,27 @@ class Editor(BaseApiClient):
|
|
354
355
|
# 调用edit_pdf方法处理API请求
|
355
356
|
return await self.edit_pdf(file_path, EditType.ADD_WATERMARK, extra_params, password, original_name)
|
356
357
|
|
358
|
+
async def remove_margin(self, file_path: str, password: Optional[str] = None, original_name: Optional[str] = None) -> EditResult:
|
359
|
+
"""去除PDF文件的白边
|
360
|
+
|
361
|
+
Args:
|
362
|
+
file_path: 要去除白边的PDF文件路径
|
363
|
+
password: 文档密码,如果文档受密码保护,则需要提供(可选)
|
364
|
+
original_name: 原始文件名(可选)
|
365
|
+
|
366
|
+
Returns:
|
367
|
+
EditResult: 去除白边的结果
|
368
|
+
"""
|
369
|
+
# 验证输入文件是否为PDF
|
370
|
+
if not await self._validate_pdf_file(file_path):
|
371
|
+
return EditResult(success=False, file_path=file_path, error_message="非PDF文件", original_name=original_name)
|
372
|
+
|
373
|
+
# 记录操作描述
|
374
|
+
await self._log_operation("去除PDF文件白边")
|
375
|
+
|
376
|
+
# 调用edit_pdf方法处理API请求,去除白边不需要额外参数
|
377
|
+
return await self.edit_pdf(file_path, EditType.REMOVE_MARGIN, {}, password, original_name)
|
378
|
+
|
357
379
|
async def edit_pdf(self, file_path: str, edit_type: EditType, extra_params: Dict[str, Any] = None, password: Optional[str] = None, original_name: Optional[str] = None) -> EditResult:
|
358
380
|
"""编辑PDF文件
|
359
381
|
|
lightpdf_aipdf_mcp/server.py
CHANGED
@@ -362,7 +362,7 @@ async def handle_list_tools() -> list[types.Tool]:
|
|
362
362
|
"format": {
|
363
363
|
"type": "string",
|
364
364
|
"description": "目标格式",
|
365
|
-
"enum": ["pdf", "docx", "xlsx", "pptx", "jpg", "jpeg", "png", "
|
365
|
+
"enum": ["pdf", "docx", "xlsx", "pptx", "jpg", "jpeg", "png", "html", "txt"]
|
366
366
|
}
|
367
367
|
},
|
368
368
|
"required": ["files", "format"]
|
@@ -761,6 +761,38 @@ async def handle_list_tools() -> list[types.Tool]:
|
|
761
761
|
},
|
762
762
|
"required": ["files", "rotates"]
|
763
763
|
}
|
764
|
+
),
|
765
|
+
types.Tool(
|
766
|
+
name="remove_margin",
|
767
|
+
description="去除PDF文件的白边(页边距)。",
|
768
|
+
inputSchema={
|
769
|
+
"type": "object",
|
770
|
+
"properties": {
|
771
|
+
"files": {
|
772
|
+
"type": "array",
|
773
|
+
"items": {
|
774
|
+
"type": "object",
|
775
|
+
"properties": {
|
776
|
+
"path": {
|
777
|
+
"type": "string",
|
778
|
+
"description": "需要去除白边的PDF文件路径或URL"
|
779
|
+
},
|
780
|
+
"password": {
|
781
|
+
"type": "string",
|
782
|
+
"description": "PDF文档密码,如果文档受密码保护,则需要提供此参数"
|
783
|
+
},
|
784
|
+
"name": {
|
785
|
+
"type": "string",
|
786
|
+
"description": "文件的原始文件名"
|
787
|
+
}
|
788
|
+
},
|
789
|
+
"required": ["path"]
|
790
|
+
},
|
791
|
+
"description": "需要去除白边的PDF文件列表,每个文件包含路径和可选的密码"
|
792
|
+
}
|
793
|
+
},
|
794
|
+
"required": ["files"]
|
795
|
+
}
|
764
796
|
)
|
765
797
|
]
|
766
798
|
|
@@ -823,6 +855,10 @@ async def handle_call_tool(name: str, arguments: dict | None) -> list[types.Text
|
|
823
855
|
"edit_type": "rotate", # 编辑类型
|
824
856
|
"is_edit_operation": True, # 标记为编辑操作
|
825
857
|
"param_keys": ["rotates"] # 只需要rotates参数,移除对旧格式的支持
|
858
|
+
},
|
859
|
+
"remove_margin": {
|
860
|
+
"edit_type": "edit", # 编辑类型
|
861
|
+
"is_edit_operation": True, # 标记为编辑操作
|
826
862
|
}
|
827
863
|
}
|
828
864
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: lightpdf-aipdf-mcp
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.55
|
4
4
|
Summary: MCP Server for LightPDF AI-PDF
|
5
5
|
Author: LightPDF Team
|
6
6
|
License: Proprietary
|
@@ -99,7 +99,7 @@ pip install lightpdf-aipdf-mcp
|
|
99
99
|
- Word (DOCX)
|
100
100
|
- Excel (XLSX)
|
101
101
|
- PowerPoint (PPTX)
|
102
|
-
- 图片 (JPG, JPEG, PNG
|
102
|
+
- 图片 (JPG, JPEG, PNG)
|
103
103
|
- HTML
|
104
104
|
- 文本 (TXT)
|
105
105
|
|
@@ -107,7 +107,7 @@ pip install lightpdf-aipdf-mcp
|
|
107
107
|
- Word (DOCX)
|
108
108
|
- Excel (XLSX)
|
109
109
|
- PowerPoint (PPTX)
|
110
|
-
- 图片 (JPG, JPEG, PNG
|
110
|
+
- 图片 (JPG, JPEG, PNG)
|
111
111
|
- CAD (DWG)
|
112
112
|
- CAJ
|
113
113
|
- OFD
|
@@ -192,8 +192,6 @@ pip install lightpdf-aipdf-mcp
|
|
192
192
|
- `pptx`: 转换为PowerPoint格式
|
193
193
|
- `jpg`/`jpeg`: 转换为JPG格式
|
194
194
|
- `png`: 转换为PNG格式
|
195
|
-
- `bmp`: 转换为BMP格式
|
196
|
-
- `gif`: 转换为GIF格式
|
197
195
|
- `html`: 转换为HTML格式
|
198
196
|
- `txt`: 转换为文本格式
|
199
197
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
lightpdf_aipdf_mcp/__init__.py,sha256=PPnAgpvJLYLVOTxnHDmJAulFnHJD6wuTwS6tRGjqq6s,141
|
2
|
+
lightpdf_aipdf_mcp/common.py,sha256=-7LU6gm-As_F8Ly68ssy15Vc9Zt_eNSnvDLEtVZDwlI,6633
|
3
|
+
lightpdf_aipdf_mcp/converter.py,sha256=d90pNUT8pQn93u1fJSlu4f2KyLDzhOdTrqyBkSTRFBE,14450
|
4
|
+
lightpdf_aipdf_mcp/editor.py,sha256=hwj_wR0zjAEH6H7OfYnL9VHUQbVbbRY1cuT8mv-x3oE,24594
|
5
|
+
lightpdf_aipdf_mcp/server.py,sha256=ZG-JDHpYRRwU0YNnQ8tRUHs0p13vvCN4iry-aYPe800,43035
|
6
|
+
lightpdf_aipdf_mcp-0.1.55.dist-info/METADATA,sha256=Zb_ZIj1hQ64jAQwcojvrEGM6Qfbt-jeq5vNICnNvgHA,7826
|
7
|
+
lightpdf_aipdf_mcp-0.1.55.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
8
|
+
lightpdf_aipdf_mcp-0.1.55.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
|
9
|
+
lightpdf_aipdf_mcp-0.1.55.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
lightpdf_aipdf_mcp/__init__.py,sha256=PPnAgpvJLYLVOTxnHDmJAulFnHJD6wuTwS6tRGjqq6s,141
|
2
|
-
lightpdf_aipdf_mcp/common.py,sha256=-7LU6gm-As_F8Ly68ssy15Vc9Zt_eNSnvDLEtVZDwlI,6633
|
3
|
-
lightpdf_aipdf_mcp/converter.py,sha256=QBwKcCg83FrGGDCy3IFyXjldIZg2hzej_zCH8nyOPak,14768
|
4
|
-
lightpdf_aipdf_mcp/editor.py,sha256=RuHxTMlyvUp2keh0Plue2g4vwGe4Vzv5mauJuncyM8o,23551
|
5
|
-
lightpdf_aipdf_mcp/server.py,sha256=mgCXhdPPusssVDQAFyFuSrfHr_PUffztpJSWsg9newY,41455
|
6
|
-
lightpdf_aipdf_mcp-0.1.54.dist-info/METADATA,sha256=082iWOLst2JL_k0HoKrp0PDeIz6IlswN14AZgaxaRuE,7906
|
7
|
-
lightpdf_aipdf_mcp-0.1.54.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
8
|
-
lightpdf_aipdf_mcp-0.1.54.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
|
9
|
-
lightpdf_aipdf_mcp-0.1.54.dist-info/RECORD,,
|
File without changes
|
{lightpdf_aipdf_mcp-0.1.54.dist-info → lightpdf_aipdf_mcp-0.1.55.dist-info}/entry_points.txt
RENAMED
File without changes
|