|
22 | 22 | [switch]$SkipReference, |
23 | 23 | [switch]$SkipInstall, |
24 | 24 | [switch]$WithOffice, |
25 | | - [switch]$SkipOffice |
| 25 | + [switch]$SkipOffice, |
| 26 | + [ValidateSet("libre", "office")] |
| 27 | + [string]$Engine = "office" |
26 | 28 | ) |
27 | 29 |
|
28 | 30 | $ErrorActionPreference = "Continue" |
@@ -93,14 +95,26 @@ if ($xlsxFiles -and $xlsxFiles.Count -gt 0) { |
93 | 95 | } |
94 | 96 |
|
95 | 97 | if (-not $CompareOnly -and -not $SkipReference) { |
96 | | - Write-Host '[Step 2] Converting XLSX -> PDF (LibreOffice)...' -ForegroundColor Yellow |
97 | | - Push-Location $BenchmarkDir |
98 | | - try { |
99 | | - $refArgs = @("generate_reference_pdfs.py", "--xlsx-dir", $XlsxIssueDir, "--pdf-dir", $RefXlsx) |
100 | | - if ($Filter) { $refArgs += @("--filter", $Filter) } |
101 | | - python @refArgs |
102 | | - } finally { |
103 | | - Pop-Location |
| 98 | + if ($Engine -eq 'office') { |
| 99 | + Write-Host '[Step 2] Converting XLSX -> PDF (Office / Excel COM)...' -ForegroundColor Yellow |
| 100 | + Push-Location $BenchmarkDir |
| 101 | + try { |
| 102 | + $refArgs = @("generate_office_pdfs.py", "--xlsx-dir", $XlsxIssueDir, "--pdf-dir", $RefXlsx) |
| 103 | + if ($Filter) { $refArgs += @("--filter", $Filter) } |
| 104 | + python @refArgs |
| 105 | + } finally { |
| 106 | + Pop-Location |
| 107 | + } |
| 108 | + } else { |
| 109 | + Write-Host '[Step 2] Converting XLSX -> PDF (LibreOffice)...' -ForegroundColor Yellow |
| 110 | + Push-Location $BenchmarkDir |
| 111 | + try { |
| 112 | + $refArgs = @("generate_reference_pdfs.py", "--xlsx-dir", $XlsxIssueDir, "--pdf-dir", $RefXlsx) |
| 113 | + if ($Filter) { $refArgs += @("--filter", $Filter) } |
| 114 | + python @refArgs |
| 115 | + } finally { |
| 116 | + Pop-Location |
| 117 | + } |
104 | 118 | } |
105 | 119 | } |
106 | 120 |
|
@@ -153,14 +167,26 @@ if ($docxFiles -and $docxFiles.Count -gt 0) { |
153 | 167 | } |
154 | 168 |
|
155 | 169 | if (-not $CompareOnly -and -not $SkipReference) { |
156 | | - Write-Host '[Step 2] Converting DOCX -> PDF (LibreOffice)...' -ForegroundColor Yellow |
157 | | - Push-Location $BenchmarkDir |
158 | | - try { |
159 | | - $refArgs = @("generate_reference_pdfs_docx.py", "--docx-dir", $DocxIssueDir, "--pdf-dir", $RefDocx) |
160 | | - if ($Filter) { $refArgs += @("--filter", $Filter) } |
161 | | - python @refArgs |
162 | | - } finally { |
163 | | - Pop-Location |
| 170 | + if ($Engine -eq 'office') { |
| 171 | + Write-Host '[Step 2] Converting DOCX -> PDF (Office / Word COM)...' -ForegroundColor Yellow |
| 172 | + Push-Location $BenchmarkDir |
| 173 | + try { |
| 174 | + $refArgs = @("generate_office_pdfs_docx.py", "--docx-dir", $DocxIssueDir, "--pdf-dir", $RefDocx) |
| 175 | + if ($Filter) { $refArgs += @("--filter", $Filter) } |
| 176 | + python @refArgs |
| 177 | + } finally { |
| 178 | + Pop-Location |
| 179 | + } |
| 180 | + } else { |
| 181 | + Write-Host '[Step 2] Converting DOCX -> PDF (LibreOffice)...' -ForegroundColor Yellow |
| 182 | + Push-Location $BenchmarkDir |
| 183 | + try { |
| 184 | + $refArgs = @("generate_reference_pdfs_docx.py", "--docx-dir", $DocxIssueDir, "--pdf-dir", $RefDocx) |
| 185 | + if ($Filter) { $refArgs += @("--filter", $Filter) } |
| 186 | + python @refArgs |
| 187 | + } finally { |
| 188 | + Pop-Location |
| 189 | + } |
164 | 190 | } |
165 | 191 | } |
166 | 192 |
|
|
0 commit comments