### MiniPdf implementation .NET (C#) ### Source document type DOCX ### Authoring application Microsoft Office ### Authoring application version _No response_ ### MiniPdf version 0.42.0 ### Environment MiniPdf library ### Runtime or host details .Net8 ### Operating system window ### Minimal test example static void Main(string[] args) { // 定义输入和输出路径 string inputPath = "doc\\input.docx"; string outputPath = "doc\\output.pdf"; // 确保输出目录存在 string outputDirectory = Path.GetDirectoryName(outputPath); if (!string.IsNullOrEmpty(outputDirectory) && !Directory.Exists(outputDirectory)) { Directory.CreateDirectory(outputDirectory); } // 执行转换 MiniPdf.ConvertToPdf(inputPath, outputPath); Console.WriteLine($"PDF 已生成: {Path.GetFullPath(outputPath)}"); Console.WriteLine("转换完成!"); } ### Input and output files word文件: [input.docx](https://github.com/user-attachments/files/31951652/input.docx) 输出结果: [output.pdf](https://github.com/user-attachments/files/31951651/output.pdf) ### Additional context ```text ```
Activity
jeff377 commentedon Sep 11, 2026
在 macOS 上用附件的
input.docx重現了,提供結果與原因分析,供維護者判斷。測試環境:
main@54f06487、macOS arm64、.NET SDK 9.0.317,以 CLI 轉檔。症狀
頁尾沒有顯示頁碼,而是印出內部的佔位字串。附件的
output.pdf(0.42.0)與目前main轉出的結果相同,兩頁都是:觸發條件:頁碼欄位位於頁首/頁尾的表格內
input.docx的頁尾(footer1.xml)是一個三欄表格,PAGE與NUMPAGES欄位在右欄。另以最小文件對照(兩頁本文,只改變頁碼欄位的位置):
Page 1 of 2、Page 2 of 2Page {PAGE} of {NUMPAGES}Page {PAGE} of {NUMPAGES}原因
DocxReader把PAGE/NUMPAGES欄位讀成佔位字串,繪製時才替換成數字。RenderHeaderFooterElementsOnPage的兩個分支處理方式不同:DocxToPdfConverter.cs#L3598-L3600呼叫ResolvePagePlaceholders。#L3628呼叫RenderHeaderFooterTable(page, options, table, y),沒有傳入pageIndex、totalPages、sectionPageNum;該方法組出儲存格文字(#L3745)後也沒有替換。另外,
#L3763的WordWrap量測的是未替換的字串,所以在 1134 dxa 的窄欄裡被折成兩行。修正時,替換可能需要放在換行量測之前。備註
Page 1 of 2是依 Word 欄位語意推定,沒有用 Word 實際轉出來對照。CalculateRowHeight、CalculateCellContentHeight)是否也使用未替換的字串。