Skip to content
DemoFAQ

PDF 生成模板编辑器

开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。

查看 GitHub

SDK Package Structure ​

The ComPDF Conversion SDK for Python should contain at least the following:

  • "doc" - API reference and developer guide.
  • "samples" - Python sample projects or scripts.
  • "resource" - OCR models, DocumentAI models, and other resource files.
  • Python installation package or module distribution files.
  • "release_notes.txt" - Release notes.
  • "legal.txt" - Legal and copyright information.

关于模型文件:SDK 包内默认自带基础模型 documentai.model(位于 resource/models 目录),使用默认配置无需额外下载其他模型文件。仅在需要更高精度的版本或扩展功能时,才需要从 https://download.compdf.com/download/models 额外下载对应的扩展模型包,详见“3.20 模型包说明”。

package  Apply the License Key If you don't have a license key, please check out how to obtain a license key.

ComPDF Conversion SDK currently supports offline authentication to verify license keys.

Learn about:

What is the authentication mechanism of ComPDF's license?

Copy the License Key ​

Accurately obtaining the license key is crucial for the application of the license.

  1. In the email you received, locate the XML file containing the license key.
  2. Open the XML file, and determine the license type based on the <type> field. If <type>online</type> is present, it indicates an online license. If <type>offline</type> is present or if the field is absent, it indicates an offline license.

Online License:

xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<license version="1">
    <platform>windows</platform>
    <starttime>xxxxxxxx</starttime>
    <endtime>xxxxxxxx</endtime>
    <type>online</type>
    <key>LICENSE_KEY</key>
</license>

Offline License:

xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<license version="1">
    <platform>windows</platform>
    <starttime>xxxxxxxx</starttime>
    <endtime>xxxxxxxx</endtime>
    <key>LICENSE_KEY</key>
</license>
  1. Copy the value located at the LICENSE_KEY position within the <key>LICENSE_KEY</key> field. This is your license key.

Apply the License Key ​

You can perform offline authentication using the following method:

Before using the classes and methods of the ComPDF Conversion SDK in your project, you need to initialize the SDK with a valid license key. If you don’t have a license key, feel free to contact the ComPDF team to obtain one.

python
from ComPDFKitConversion import *

error_code = LibraryManager.license_verify("", "", "")