2025-12-09 11:00:05,937 [INFO] [app:1607] URL参数解析: template_id=1763706916694, format_type=pdf, page_size=A4, scale_factor=0.7, landscape=False, data_param={"序号":"6222021234567890123","时间":"2023-11-04","内容":"开发服务器","名字":"北京科技有限公司"}
2025-12-09 11:00:05,938 [INFO] [app:1608] 所有URL参数: {'templateId': '1763706916694', 'format': 'pdf', 'data': '{"序号":"6222021234567890123","时间":"2023-11-04","内容":"开发服务器","名字":"北京科技有限公司"}'}
2025-12-09 11:00:05,938 [INFO] [app:1623] 解析后的field_data: {'序号': '6222021234567890123', '时间': '2023-11-04', '内容': '开发服务器', '名字': '北京科技有限公司'}
2025-12-09 11:00:05,938 [INFO] [app:1645] 最终参数: template_id=1763706916694, format_type=pdf, page_size=A4, scale_factor=0.7, landscape=False, field_data={'序号': '6222021234567890123', '时间': '2023-11-04', '内容': '开发服务器', '名字': '北京科技有限公司'}
2025-12-09 11:00:05,938 [INFO] [app:650] 替换前的数据: {'序号': '6222021234567890123', '时间': '2023-11-04', '内容': '开发服务器', '名字': '北京科技有限公司'}
2025-12-09 11:00:05,939 [INFO] [app:651] 模板内容前100个字符: <div class="excel-container">
<table class="excel-table" style="width: 59.9804%; height: 1389.73px;
2025-12-09 11:00:05,939 [INFO] [app:680] 模板中发现的占位符: ['ลำดับ', '时间', '名字', '内容']
2025-12-09 11:00:05,939 [INFO] [app:691] 字段出现次数统计: {'ลำดับ': 1, '时间': 1, '名字': 1, '内容': 1}
2025-12-09 11:00:05,939 [INFO] [app:593] get_placeholder_value: fieldName=ลำดับ, search_result_fields={'序号': '6222021234567890123', '时间': '2023-11-04', '内容': '开发服务器', '名字': '北京科技有限公司'}, record_data_fields={}
2025-12-09 11:00:05,939 [INFO] [app:644] 未找到匹配字段,返回字段名本身: ลำดับ
2025-12-09 11:00:05,939 [INFO] [app:701] 字段 'ลำดับ' 获取到的值: ลำดับ
2025-12-09 11:00:05,939 [INFO] [app:710] 找到占位符 {$ลำดับ},进行替换
2025-12-09 11:00:05,940 [INFO] [app:593] get_placeholder_value: fieldName=时间, search_result_fields={'序号': '6222021234567890123', '时间': '2023-11-04', '内容': '开发服务器', '名字': '北京科技有限公司'}, record_data_fields={}
2025-12-09 11:00:05,940 [INFO] [app:610] 精确匹配成功: 时间 = 2023-11-04
2025-12-09 11:00:05,940 [INFO] [app:701] 字段 '时间' 获取到的值: 2023-11-04
2025-12-09 11:00:05,940 [INFO] [app:710] 找到占位符 {$时间},进行替换
2025-12-09 11:00:05,940 [INFO] [app:593] get_placeholder_value: fieldName=名字, search_result_fields={'序号': '6222021234567890123', '时间': '2023-11-04', '内容': '开发服务器', '名字': '北京科技有限公司'}, record_data_fields={}
2025-12-09 11:00:05,940 [INFO] [app:610] 精确匹配成功: 名字 = 北京科技有限公司
2025-12-09 11:00:05,940 [INFO] [app:701] 字段 '名字' 获取到的值: 北京科技有限公司
2025-12-09 11:00:05,940 [INFO] [app:710] 找到占位符 {$名字},进行替换
2025-12-09 11:00:05,940 [INFO] [app:593] get_placeholder_value: fieldName=内容, search_result_fields={'序号': '6222021234567890123', '时间': '2023-11-04', '内容': '开发服务器', '名字': '北京科技有限公司'}, record_data_fields={}
2025-12-09 11:00:05,940 [INFO] [app:610] 精确匹配成功: 内容 = 开发服务器
2025-12-09 11:00:05,940 [INFO] [app:701] 字段 '内容' 获取到的值: 开发服务器
2025-12-09 11:00:05,940 [INFO] [app:710] 找到占位符 {$内容},进行替换
2025-12-09 11:00:05,940 [INFO] [app:723] 替换结果长度: 22875
2025-12-09 11:00:05,940 [INFO] [app:593] get_placeholder_value: fieldName=ลำดับ, search_result_fields={'序号': '6222021234567890123', '时间': '2023-11-04', '内容': '开发服务器', '名字': '北京科技有限公司'}, record_data_fields={}
2025-12-09 11:00:05,940 [INFO] [app:644] 未找到匹配字段,返回字段名本身: ลำดับ
2025-12-09 11:00:05,941 [WARNING] [app:746] 字段 'ลำดับ' 的值 'ลดับ' 在结果中出现了 2 次,可能存在重复
2025-12-09 11:00:05,941 [INFO] [app:593] get_placeholder_value: fieldName=时间, search_result_fields={'序号': '6222021234567890123', '时间': '2023-11-04', '内容': '开发服务器', '名字': '北京科技有限公司'}, record_data_fields={}
2025-12-09 11:00:05,941 [INFO] [app:610] 精确匹配成功: 时间 = 2023-11-04
2025-12-09 11:00:05,941 [INFO] [app:593] get_placeholder_value: fieldName=名字, search_result_fields={'序号': '6222021234567890123', '时间': '2023-11-04', '内容': '开发服务器', '名字': '北京科技有限公司'}, record_data_fields={}
2025-12-09 11:00:05,941 [INFO] [app:610] 精确匹配成功: 名字 = 北京科技有限公司
2025-12-09 11:00:05,941 [INFO] [app:593] get_placeholder_value: fieldName=内容, search_result_fields={'序号': '6222021234567890123', '时间': '2023-11-04', '内容': '开发服务器', '名字': '北京科技有限公司'}, record_data_fields={}
2025-12-09 11:00:05,941 [INFO] [app:610] 精确匹配成功: 内容 = 开发服务器
2025-12-09 11:00:05,944 [INFO] [app:773] 已移除template-field相关的CSS类和属性
2025-12-09 11:00:05,972 [INFO] [app:1902] HTML中间文件已生成: storage/htmls/template_1763706916694_20251209_110005_intermediate.html
2025-12-09 11:00:05,973 [INFO] [pdf_generator_factory:36] 初始化PDF生成器工厂
2025-12-09 11:00:05,973 [INFO] [pdf_generator_factory:108] 生成器启用配置: chrome=True, playwright=True, fixed=False, optimized=True, weasyprint=True, wkhtmltopdf=True
2025-12-09 11:00:05,973 [INFO] [chrome_pdf_generator:66] 检测到pyppeteer库,将使用pyppeteer控制Chrome
2025-12-09 11:00:05,973 [INFO] [pdf_generator_factory:115] 成功加载ChromePDFGenerator (首选生成器)
2025-12-09 11:00:05,973 [INFO] [chrome_pdf_generator:66] 检测到pyppeteer库,将使用pyppeteer控制Chrome
2025-12-09 11:00:05,973 [INFO] [chrome_pdf_generator:40] 强制使用playwright控制Chrome
2025-12-09 11:00:05,973 [INFO] [chrome_pdf_generator:46] playwright库可用,生成器已初始化
2025-12-09 11:00:05,973 [INFO] [pdf_generator_factory:141] 成功加载PlaywrightPDFGenerator
2025-12-09 11:00:05,973 [INFO] [pdf_generator_factory:160] MultiLanguagePDFGenerator (FPDF生成器)已被禁用
2025-12-09 11:00:05,974 [INFO] [optimized_pdf_generator:334] 使用WeasyPrint但未初始化字体配置
2025-12-09 11:00:05,974 [INFO] [pdf_generator_factory:167] 成功加载OptimizedPDFGenerator
2025-12-09 11:00:05,975 [INFO] [optimized_pdf_generator:334] 使用WeasyPrint但未初始化字体配置
2025-12-09 11:00:05,975 [INFO] [pdf_generator_factory:184] WeasyPrint专用生成器加载成功
2025-12-09 11:00:05,975 [INFO] [pdf_generator_factory:198] 已加载wkhtmltopdf生成器
2025-12-09 11:00:05,975 [INFO] [pdf_generator_factory:59] 使用优化后的默认生成器优先级: ['chrome', 'playwright', 'weasyprint', 'optimized', 'wkhtmltopdf', 'fixed']
2025-12-09 11:00:05,975 [INFO] [app:1916] 使用智能PDF生成器工厂
2025-12-09 11:00:05,975 [INFO] [pdf_generator_factory:631] 开始智能生成PDF: storage/pdfs/template_1763706916694_20251209_110005.pdf
2025-12-09 11:00:05,989 [INFO] [pdf_generator_factory:310] 模板分析结果: 泰文=True, 中日韩=False, 表格=True, 嵌套表格=False, 复杂HTML=False
2025-12-09 11:00:05,990 [INFO] [pdf_generator_factory:649] 按照配置的优先级顺序选择生成器,优先保留HTML格式
2025-12-09 11:00:05,990 [INFO] [pdf_generator_factory:659] 选择生成器: chrome (优先级: 1)
2025-12-09 11:00:05,990 [INFO] [pdf_generator_factory:679] 使用chrome生成器
2025-12-09 11:00:06,000 [INFO] [chrome_pdf_generator:108] 使用Chrome生成PDF: storage/pdfs/template_1763706916694_20251209_110005.pdf
[W:pyppeteer.chromium_downloader] start chromium download.
Download may take a few minutes.
2025-12-09 11:00:06,434 [WARNING] [connectionpool:868] Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectionResetError(104, 'Connection reset by peer')': /chromium-browser-snapshots/Linux_x64/575458/chrome-linux.zip
2025-12-09 11:00:06,651 [WARNING] [connectionpool:868] Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectionResetError(104, 'Connection reset by peer')': /chromium-browser-snapshots/Linux_x64/575458/chrome-linux.zip
2025-12-09 11:00:06,883 [WARNING] [connectionpool:868] Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectionResetError(104, 'Connection reset by peer')': /chromium-browser-snapshots/Linux_x64/575458/chrome-linux.zip
2025-12-09 11:02:20,181 [ERROR] [chrome_pdf_generator:200] 使用pyppeteer生成PDF时出错: HTTPSConnectionPool(host='storage.googleapis.com', port=443): Max retries exceeded with url: /chromium-browser-snapshots/Linux_x64/575458/chrome-linux.zip (Caused by ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')))
2025-12-09 11:02:20,181 [WARNING] [pdf_generator_factory:746] PDF生成失败: storage/pdfs/template_1763706916694_20251209_110005.pdf (使用chrome生成器)
2025-12-09 11:02:20,181 [INFO] [pdf_generator_factory:757] 尝试使用回退策略生成PDF
2025-12-09 11:02:20,181 [INFO] [pdf_generator_factory:347] 调整策略优先级: thai_heavy -> 因失败率高(1.00),将chrome移至末尾
2025-12-09 11:02:20,182 [INFO] [pdf_generator_factory:767] 尝试使用回退生成器: playwright
2025-12-09 11:02:20,182 [INFO] [chrome_pdf_generator:108] 使用Chrome生成PDF: storage/pdfs/template_1763706916694_20251209_110005.pdf
2025-12-09 11:02:21,016 [ERROR] [chrome_pdf_generator:291] 使用playwright生成PDF时出错: BrowserType.launch: Executable doesn't exist at /root/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell
╔════════════════════════════════════════════════════════════╗
║ Looks like Playwright was just installed or updated. ║
║ Please run the following command to download new browsers: ║
║ ║
║ playwright install ║
║ ║
║ <3 Playwright Team ║
╚════════════════════════════════════════════════════════════╝
2025-12-09 11:02:21,017 [ERROR] [chrome_pdf_generator:293] 错误堆栈: Traceback (most recent call last):
File "/www/wwwroot/feishu-print-main/feishu-print-main/./chrome_pdf_generator.py", line 288, in _generate_with_playwright
return asyncio.run(generate_pdf_async())
File "/www/server/pyporject_evn/versions/3.10.7/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/www/server/pyporject_evn/versions/3.10.7/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/www/wwwroot/feishu-print-main/feishu-print-main/./chrome_pdf_generator.py", line 245, in generate_pdf_async
browser = await p.chromium.launch(
File "/www/wwwroot/feishu-print-main/.venv/lib/python3.10/site-packages/playwright/async_api/_generated.py", line 14495, in launch
await self._impl_obj.launch(
File "/www/wwwroot/feishu-print-main/.venv/lib/python3.10/site-packages/playwright/_impl/_browser_type.py", line 98, in launch
await self._channel.send(
File "/www/wwwroot/feishu-print-main/.venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 69, in send
return await self._connection.wrap_api_call(
File "/www/wwwroot/feishu-print-main/.venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 559, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: BrowserType.launch: Executable doesn't exist at /root/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell
╔════════════════════════════════════════════════════════════╗
║ Looks like Playwright was just installed or updated. ║
║ Please run the following command to download new browsers: ║
║ ║
║ playwright install ║
║ ║
║ <3 Playwright Team ║
╚════════════════════════════════════════════════════════════╝
2025-12-09 11:02:21,018 [INFO] [pdf_generator_factory:767] 尝试使用回退生成器: weasyprint
2025-12-09 11:02:21,018 [INFO] [optimized_pdf_generator:552] 强制使用WeasyPrint生成PDF: storage/pdfs/template_1763706916694_20251209_110005.pdf
2025-12-09 11:02:21,020 [INFO] [optimized_pdf_generator:735] 开始WeasyPrint生成,输出路径: storage/pdfs/template_1763706916694_20251209_110005.pdf
2025-12-09 11:02:21,022 [INFO] [optimized_pdf_generator:739] HTML内容预处理完成,长度: 27925 字符
2025-12-09 11:02:21,035 [INFO] [optimized_pdf_generator:745] 检测到的语言: {'thai', 'chinese'}
2025-12-09 11:02:21,036 [INFO] [optimized_pdf_generator:223] 找到匹配字体: Tahoma -> tahoma.ttf (/usr/share/fonts/chinese/tahoma.ttf)
2025-12-09 11:02:21,037 [ERROR] [optimized_pdf_generator:992] WeasyPrint生成PDF失败: name 'font' is not defined
2025-12-09 11:02:21,037 [ERROR] [optimized_pdf_generator:993] 错误类型: NameError
2025-12-09 11:02:21,040 [ERROR] [optimized_pdf_generator:995] 错误堆栈: Traceback (most recent call last):
File "/www/wwwroot/feishu-print-main/feishu-print-main/./optimized_pdf_generator.py", line 758, in generate_pdf_with_weasyprint
font-family: '{font_name}';
NameError: name 'font' is not defined
2025-12-09 11:02:21,040 [ERROR] [optimized_pdf_generator:567] ❌ 强制WeasyPrint生成失败
2025-12-09 11:02:21,040 [INFO] [pdf_generator_factory:767] 尝试使用回退生成器: optimized
2025-12-09 11:02:21,040 [INFO] [pdf_generator_factory:767] 尝试使用回退生成器: wkhtmltopdf
2025-12-09 11:02:21,040 [INFO] [wkhtmltopdf_generator:146] 执行wkhtmltopdf命令: /bin/wkhtmltopdf --quiet --enable-local-file-access --page-size A4 /tmp/tmpsor4a1x6/input.html storage/pdfs/template_1763706916694_20251209_110005.pdf
2025-12-09 11:02:21,653 [ERROR] [wkhtmltopdf_generator:159] wkhtmltopdf执行失败 (返回码: 1):
错误输出: QStandardPaths: runtime directory '/run/user/0' is not owned by UID 1000, but a directory permissions 0700 owned by UID 0 GID 0
Exit with code 1 due to network error: ProtocolUnknownError
标准输出:
2025-12-09 11:02:21,653 [ERROR] [wkhtmltopdf_generator:169] 生成PDF时出错: wkhtmltopdf执行失败 (返回码: 1):
错误输出: QStandardPaths: runtime directory '/run/user/0' is not owned by UID 1000, but a directory permissions 0700 owned by UID 0 GID 0
Exit with code 1 due to network error: ProtocolUnknownError
标准输出:
2025-12-09 11:02:21,654 [ERROR] [pdf_generator_factory:812] 使用回退生成器wkhtmltopdf时出错: wkhtmltopdf执行失败 (返回码: 1):
错误输出: QStandardPaths: runtime directory '/run/user/0' is not owned by UID 1000, but a directory permissions 0700 owned by UID 0 GID 0
Exit with code 1 due to network error: ProtocolUnknownError
标准输出:
2025-12-09 11:02:21,654 [ERROR] [pdf_generator_factory:823] PDF生成失败: storage/pdfs/template_1763706916694_20251209_110005.pdf (所有生成器均失败)
2025-12-09 11:02:21,654 [WARNING] [app:1931] 智能PDF生成器返回失败
2025-12-09 11:02:21,654 [INFO] [app:1940] 使用修复版PDF生成函数作为回退方案
2025-12-09 11:02:21,654 [WARNING] [app:837] 多语言PDF生成器不用,使用传统方法
2025-12-09 11:02:21,704 [WARNING] [descriptors:62] Ignored `src: url("C:/Windows/Fonts/msyh.ttc")` at 12:25, Relative URI reference without a base URI: None.
2025-12-09 11:02:21,705 [WARNING] [__init__:1603] Missing src descriptor in '@font-face' rule at 10:21
2025-12-09 11:02:21,705 [WARNING] [descriptors:62] Ignored `src: url("C:/Windows/Fonts/msyhbd.ttc")` at 16:25, Relative URI reference without a base URI: None.
2025-12-09 11:02:21,705 [WARNING] [__init__:1603] Missing src descriptor in '@font-face' rule at 14:21
2025-12-09 11:02:21,705 [WARNING] [descriptors:62] Ignored `src: url("C:/Windows/Fonts/simhei.ttf")` at 21:25, Relative URI reference without a base URI: None.
2025-12-09 11:02:21,705 [WARNING] [__init__:1603] Missing src descriptor in '@font-face' rule at 19:21
2025-12-09 11:02:21,705 [WARNING] [descriptors:62] Ignored `src: url("C:/Windows/Fonts/arialuni.ttf")` at 25:25, Relative URI reference without a base URI: None.
2025-12-09 11:02:21,705 [WARNING] [__init__:1603] Missing src descriptor in '@font-face' rule at 23:21
2025-12-09 11:02:21,708 [WARNING] [__init__:188] Ignored `overflow-x: auto` at 82:25, unknown property.
2025-12-09 11:02:21,713 [WARNING] [descriptors:62] Ignored `src: url("C:/Windows/Fonts/msyh.ttc")` at 10:25, Relative URI reference without a base URI: None.
2025-12-09 11:02:21,713 [WARNING] [__init__:1603] Missing src descriptor in '@font-face' rule at 8:21
2025-12-09 11:02:21,713 [WARNING] [descriptors:62] Ignored `src: url("C:/Windows/Fonts/simhei.ttf")` at 16:25, Relative URI reference without a base URI: None.
2025-12-09 11:02:21,713 [WARNING] [__init__:1603] Missing src descriptor in '@font-face' rule at 14:21
2025-12-09 11:02:21,714 [WARNING] [descriptors:62] Ignored `src: url("C:/Windows/Fonts/simsun.ttc")` at 22:25, Relative URI reference without a base URI: None.
2025-12-09 11:02:21,714 [WARNING] [__init__:1603] Missing src descriptor in '@font-face' rule at 20:21
2025-12-09 11:02:21,714 [WARNING] [descriptors:62] Ignored `src: url("C:/Windows/Fonts/tahoma.ttf")` at 29:25, Relative URI reference without a base URI: None.
2025-12-09 11:02:21,714 [WARNING] [__init__:1603] Missing src descriptor in '@font-face' rule at 27:21
2025-12-09 11:02:21,714 [WARNING] [descriptors:62] Ignored `src: url("C:/Windows/Fonts/micross.ttf")` at 35:25, Relative URI reference without a base URI: None.
2025-12-09 11:02:21,714 [WARNING] [__init__:1603] Missing src descriptor in '@font-face' rule at 33:21
2025-12-09 11:02:21,714 [WARNING] [__init__:188] Ignored `overflow-x: hidden` at 49:25, unknown property.
2025-12-09 11:02:21,715 [WARNING] [__init__:188] Ignored `text-rendering: optimizeLegibility` at 51:25, unknown property.
2025-12-09 11:02:21,715 [WARNING] [__init__:188] Ignored `word-break: break-word` at 61:25, invalid value.
2025-12-09 11:02:21,716 [WARNING] [__init__:188] Ignored `overflow-x: auto` at 93:25, unknown property.
2025-12-09 11:02:21,716 [WARNING] [__init__:188] Ignored `text-overflow: unset` at 99:25, invalid value.
2025-12-09 11:02:21,716 [WARNING] [__init__:188] Ignored `word-break: break-word` at 100:25, invalid value.
2025-12-09 11:02:21,965 [INFO] [app:954] 使用weasyprint成功生成修复版PDF
2025-12-09 11:02:21,965 [INFO] [app:1946] PDF文件已生成: storage/pdfs/template_1763706916694_20251209_110005.pdf
[pid: 176099|app: 0|req: 1/1] 117.30.165.146 () {34 vars in 1108 bytes} [Tue Dec 9 11:00:05 2025] POST /api/generate-document?templateId=1763706916694&format=pdf&data=%7B%22%E5%BA%8F%E5%8F%B7%22:%226222021234567890123%22,%22%E6%97%B6%E9%97%B4%22:%222023-11-04%22,%22%E5%86%85%E5%AE%B9%22:%22%E5%BC%80%E5%8F%91%E6%9C%8D%E5%8A%A1%E5%99%A8%22,%22%E5%90%8D%E5%AD%97%22:%22%E5%8C%97%E4%BA%AC%E7%A7%91%E6%8A%80%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%22%7D => generated 277 bytes in 136038 msecs (HTTP/1.1 200) 5 headers in 190 bytes (1 switches on core 0)
[pid: 176097|app: 0|req: 1/2] 113.215.188.249 () {30 vars in 474 bytes} [Tue Dec 9 11:29:48 2025] GET / => generated 207 bytes in 9 msecs (HTTP/1.1 404) 5 headers in 205 bytes (1 switches on core 0)帮我查看一下这是什么问题,怎么处理,