lightpdf-aipdf-mcp 0.1.100__py3-none-any.whl → 0.1.102__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.
@@ -274,6 +274,13 @@ class Converter(BaseApiClient):
274
274
  if original_name:
275
275
  extra_params["filename"] = os.path.splitext(original_name)[0]
276
276
 
277
+ # Excel转PDF特殊参数处理
278
+ file_ext = os.path.splitext(file_path)[1].lower()
279
+ if file_ext == ".xlsx" and format == "pdf":
280
+ merge_all = extra_params.get("merge_all", 0)
281
+ if merge_all:
282
+ extra_params["provider"] = "apower"
283
+
277
284
  # 创建转换任务
278
285
  task_id = await self._create_task(client, file_path, format, extra_params)
279
286
 
@@ -5,7 +5,7 @@ import uuid
5
5
  from .common import Logger, FileHandler
6
6
  from .editor import Editor, EditResult, EditType
7
7
 
8
- async def create_pdf_from_latex(latex_content: str, output_path: Optional[str] = None, logger: Optional[Logger] = None):
8
+ async def create_pdf_from_latex(latex_content: str, output_path: Optional[str] = None, logger: Optional[Logger] = None, original_name: Optional[str] = None):
9
9
  """
10
10
  根据LaTeX内容创建PDF文件。
11
11
 
@@ -13,6 +13,7 @@ async def create_pdf_from_latex(latex_content: str, output_path: Optional[str] =
13
13
  latex_content (str): LaTeX源内容。
14
14
  output_path (Optional[str]): 可选,输出PDF文件路径。
15
15
  logger (Optional[Logger]): 日志对象。
16
+ original_name (Optional[str]): 可选,原始文件名。
16
17
  返回:
17
18
  dict: 包含生成结果的信息(如成功与否、PDF路径、错误信息等)。
18
19
  """
@@ -40,8 +41,8 @@ async def create_pdf_from_latex(latex_content: str, output_path: Optional[str] =
40
41
  # extra_params按txt转pdf方式
41
42
  extra_params = {"pages": '[{"url": "oss://tex2pdf", "oss_file": ""}]'}
42
43
 
43
- # 这里original_name可用tex_filename
44
- result: EditResult = await editor.edit_pdf(tex_path, edit_type=EditType.EDIT, extra_params=extra_params, original_name=tex_filename)
44
+ # original_name优先用传入的参数,否则用tex_filename
45
+ result: EditResult = await editor.edit_pdf(tex_path, edit_type=EditType.EDIT, extra_params=extra_params, original_name=original_name or tex_filename)
45
46
  # 3. 返回结果
46
47
  return result
47
48
  except Exception as e:
@@ -453,7 +453,7 @@ async def handle_list_tools() -> list[types.Tool]:
453
453
  "type": "integer",
454
454
  "enum": [0, 1],
455
455
  "default": 0,
456
- "description": "Whether to merge results: 1 = merge all, 0 = separate. Only valid for: PDF to Excel (1: all pages to one sheet, 0: each page to a sheet), PDF to Image (1: merge to long image, 0: each page to an image), Image to PDF (1: all images to one PDF, 0: each image to a PDF)."
456
+ "description": "Only valid for: PDF to Image (1: merge to long image, 0: each page to an image), Image to PDF (1: all images to one PDF, 0: each image to a PDF), PDF to Excel (1: all pages to one sheet, 0: each page to a sheet), Excel to PDF (1: each sheet to a single page, 0: default, each sheet may be split into multiple pages if content is too large)."
457
457
  }
458
458
  },
459
459
  "required": ["files", "format"]
@@ -1149,9 +1149,13 @@ async def handle_list_tools() -> list[types.Tool]:
1149
1149
  "latex_content": {
1150
1150
  "type": "string",
1151
1151
  "description": "The LaTeX source content to be compiled into a PDF file."
1152
+ },
1153
+ "filename": {
1154
+ "type": "string",
1155
+ "description": "The filename for the generated PDF"
1152
1156
  }
1153
1157
  },
1154
- "required": ["latex_content"]
1158
+ "required": ["latex_content", "filename"]
1155
1159
  }
1156
1160
  ),
1157
1161
  ]
@@ -1254,7 +1258,7 @@ async def handle_call_tool(name: str, arguments: dict | None) -> list[types.Text
1254
1258
  "layout": "on", # 添加layout默认值
1255
1259
  "image_quantity": 60,
1256
1260
  "split_type": "page",
1257
- "merge_all": 1,
1261
+ "merge_all": 0,
1258
1262
  "angle": 90,
1259
1263
  "pages": "all", # 更新默认值为"all"
1260
1264
  "format": "png", # 提取图片的默认格式
@@ -1359,13 +1363,17 @@ async def handle_call_tool(name: str, arguments: dict | None) -> list[types.Text
1359
1363
  elif name == "create_pdf":
1360
1364
  from .create_pdf import create_pdf_from_latex
1361
1365
  latex_content = arguments.get("latex_content")
1366
+ filename = arguments.get("filename")
1362
1367
  if not latex_content:
1363
1368
  error_msg = "latex_content参数不能为空"
1364
1369
  await logger.error(error_msg)
1365
1370
  return [types.TextContent(type="text", text=error_msg)]
1371
+ if not filename:
1372
+ error_msg = "filename参数不能为空"
1373
+ await logger.error(error_msg)
1374
+ return [types.TextContent(type="text", text=error_msg)]
1366
1375
 
1367
- # 调用create_pdf_from_latex接口(未实现具体逻辑)
1368
- result = await create_pdf_from_latex(latex_content, logger=logger)
1376
+ result = await create_pdf_from_latex(latex_content, logger=logger, original_name=filename)
1369
1377
  # 构建结果报告
1370
1378
  report_msg = generate_result_report(
1371
1379
  [result]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lightpdf-aipdf-mcp
3
- Version: 0.1.100
3
+ Version: 0.1.102
4
4
  Summary: MCP Server for LightPDF AI-PDF
5
5
  Author: LightPDF Team
6
6
  License: Proprietary
@@ -0,0 +1,11 @@
1
+ lightpdf_aipdf_mcp/__init__.py,sha256=PPnAgpvJLYLVOTxnHDmJAulFnHJD6wuTwS6tRGjqq6s,141
2
+ lightpdf_aipdf_mcp/common.py,sha256=PhTf7Zg6mEgn1rTmJDHotXp-4xb2gWFf-Dy_t25qNdY,6660
3
+ lightpdf_aipdf_mcp/converter.py,sha256=0Xv3k_fdyrqhT_ijcXMKvkL4TuryA-crkqMzLFMHp74,16470
4
+ lightpdf_aipdf_mcp/create_pdf.py,sha256=jKyzObP3Mj55yZ7EY2D0Qx-YkppFgEm_YmoBVB0VGEs,2265
5
+ lightpdf_aipdf_mcp/editor.py,sha256=vPaahaAV6pDZi_eheRGSgHzfZxc6ZqQyxHDgsNfdgjQ,29899
6
+ lightpdf_aipdf_mcp/server.py,sha256=TX2LTGLFJEleFQcqovARpB8H1Icho0KNOsIAi6BXAnc,64558
7
+ lightpdf_aipdf_mcp/translator.py,sha256=NbFDz-mZSD4qCNQVyV0W_0x6xXwbqs_7FiBU13JAxZs,4243
8
+ lightpdf_aipdf_mcp-0.1.102.dist-info/METADATA,sha256=36DTkz1Rz5s12qjkE7ToDxfHEpgfbquJqkDUIiWdlXw,8120
9
+ lightpdf_aipdf_mcp-0.1.102.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
+ lightpdf_aipdf_mcp-0.1.102.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
11
+ lightpdf_aipdf_mcp-0.1.102.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- lightpdf_aipdf_mcp/__init__.py,sha256=PPnAgpvJLYLVOTxnHDmJAulFnHJD6wuTwS6tRGjqq6s,141
2
- lightpdf_aipdf_mcp/common.py,sha256=PhTf7Zg6mEgn1rTmJDHotXp-4xb2gWFf-Dy_t25qNdY,6660
3
- lightpdf_aipdf_mcp/converter.py,sha256=Q_4vXcysqcJ7w6bUKY9JhoBDlCRcAJSpW7p0jh5qekU,16120
4
- lightpdf_aipdf_mcp/create_pdf.py,sha256=SULJRKFghbQy7VP9GPxS6auy5nMxBN61SxgDr-Wr_lA,2120
5
- lightpdf_aipdf_mcp/editor.py,sha256=vPaahaAV6pDZi_eheRGSgHzfZxc6ZqQyxHDgsNfdgjQ,29899
6
- lightpdf_aipdf_mcp/server.py,sha256=LVzQoDvliyvAQVISIoypc8PYyK4oQZU6IhaSRbk7jA8,64112
7
- lightpdf_aipdf_mcp/translator.py,sha256=NbFDz-mZSD4qCNQVyV0W_0x6xXwbqs_7FiBU13JAxZs,4243
8
- lightpdf_aipdf_mcp-0.1.100.dist-info/METADATA,sha256=RspRt5U0lWYVktBBbv6IQu917Q15gnrOsGLYltOdeRo,8120
9
- lightpdf_aipdf_mcp-0.1.100.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- lightpdf_aipdf_mcp-0.1.100.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
11
- lightpdf_aipdf_mcp-0.1.100.dist-info/RECORD,,