This commit is contained in:
csh 2024-06-25 16:30:07 +08:00
parent 20cfa5120a
commit 2cfa0ec4af
2 changed files with 25 additions and 15 deletions

View File

@ -1,3 +1,13 @@
# WordToPdf
# PdfConverter
word转pdf工具
文件转 Pdf 工具
## 部署
将此文件夹部署到 tsl 安装目录下`funcext`即可
### 相关依赖
1. `office_plugin.dll`
2. [PDF](https://git.mytsl.cn/tinysoft/Pdf)相关包
3. [Office](https://git.mytsl.cn/tinysoft/Office)相关包

View File

@ -1,20 +1,20 @@
// NameSpace "DOCX";
WordToPdf();
function WordToPdf();
begin
alias := "";
doc := "D:\\temp\\fangan.docx";
output := "D:\\temp\\1.pdf";
// doc := "/mnt/d/temp/fontsize.docx";
// output := "/mnt/d/temp/1.pdf";
docx_to_pdf := new TSDocxToPdf(alias, doc);
docx_to_pdf.Font.UseBuiltInFont();
docx_to_pdf.Font.SetSubstitutionRules("仿宋", "宋体");
alias := "";
doc := "D:\\temp\\wordtopdf\\3M.docx";
// doc := "D:\\temp\\test1.docx";
// doc := "D:\\temp\\nihao.docx";
// doc := "D:\\temp\\wordtopdf\\3M1.docx";
output := "D:\\temp\\1.pdf";
docx_to_pdf.Transform();
err := docx_to_pdf.SaveToFile(alias, output);
echo "SaveToFile::\t", "err := ", format("%x", err), "\toutput_file := ", output, "\n";
sysparams["_PDF_PAGE_GRID_DEBUG_"] := 0;
sysparams["_PDF_TEXT_DEBUG_"] := 0;
docx_to_pdf := new TSDocxToPdf(alias, doc);
docx_to_pdf.Font.SetSubstitutionRules("仿宋", "宋体");
docx_to_pdf.Transform();
err := docx_to_pdf.SaveToFile(alias, output);
echo "SaveToFile::\t", "err := ", format("%x", err), "\toutput_file := ", output, "\n";
end;