()
| 158 | * The result is cached for the lifetime of the process. |
| 159 | */ |
| 160 | export async function isPdftoppmAvailable(): Promise<boolean> { |
| 161 | if (pdftoppmAvailable !== undefined) return pdftoppmAvailable |
| 162 | const { code, stderr } = await execFileNoThrow('pdftoppm', ['-v'], { |
| 163 | timeout: 5000, |
| 164 | useCwd: false, |
| 165 | }) |
| 166 | // pdftoppm prints version info to stderr and exits 0 (or sometimes 99 on older versions) |
| 167 | pdftoppmAvailable = code === 0 || stderr.length > 0 |
| 168 | return pdftoppmAvailable |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Extract PDF pages as JPEG images using pdftoppm. |
no test coverage detected