Skip to content

Commit

Permalink
fix: use the correct path for pdfinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
aalemayhu committed Dec 1, 2024
1 parent c66b02f commit 239d3bd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/parser/pdf/convertPDFToImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { S3 } from 'aws-sdk';

function getPageCount(pdfPath: string): Promise<number> {
return new Promise((resolve, reject) => {
execFile('/usr/local/bin/pdfinfo', [pdfPath], (error, stdout) => {
const pdfinfoBin =
process.platform === 'darwin'
? '/usr/local/bin/pdfinfo'
: '/usr/bin/pdfinfo';
execFile(pdfinfoBin, [pdfPath], (error, stdout) => {
if (error) {
reject(new Error('Failed to execute pdfinfo'));
return;
Expand Down

0 comments on commit 239d3bd

Please sign in to comment.