使用案例

使用案例

文件档案管道

将旧PostScript报告导出到PDF,以便长期存档:

from pathlib import Path
from aspose.page.ps.document import PsDocument

for ps_file in Path("reports").glob("*.ps"):
    doc = PsDocument.from_file(str(ps_file))
    out = Path("archive") / ps_file.with_suffix(".pdf").name
    out.parent.mkdir(exist_ok=True)
    out.write_bytes(doc.to_pdf())

资产分类 EPS

化EPS图片为PNG,用于Web或文档:

from pathlib import Path
from aspose.page.ps.document import PsDocument
from aspose.page.ps.output import ImageSaveOptions

for eps_file in Path("assets").glob("*.eps"):
    doc = PsDocument.from_file(str(eps_file))
    opts = ImageSaveOptions(format="png", dpi=150)
    out = Path("web") / eps_file.with_suffix(".png").name
    out.write_bytes(doc.to_image(opts))

集成IC/CD

在Docker容器和CI运行程序中,库没有GUI:

pip install aspose-page-foss>=0.1.0
python -c "from aspose.page.ps.document import PsDocument; print('OK')"

通过MCP的AI代理管道

展示转换作为可从Claude或其他MCP兼容的代理使用FastMPC选项 MCP服务器调用的MCC工具.

See Also

 中文