@heripo/pdf-parser 0.1.19 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3588,14 +3588,32 @@ var PDFConverter = class {
3588
3588
  },
3589
3589
  this.timeout
3590
3590
  );
3591
- return chunked.convertChunked(
3592
- url,
3593
- reportId,
3594
- onComplete,
3595
- cleanupAfterCallback,
3596
- options,
3597
- abortSignal
3598
- );
3591
+ try {
3592
+ return await chunked.convertChunked(
3593
+ url,
3594
+ reportId,
3595
+ onComplete,
3596
+ cleanupAfterCallback,
3597
+ options,
3598
+ abortSignal
3599
+ );
3600
+ } catch (error) {
3601
+ if (error instanceof Error && error.name === "AbortError") {
3602
+ throw error;
3603
+ }
3604
+ this.logger.warn(
3605
+ "[PDFConverter] Chunked conversion failed, retrying with image-based PDF...",
3606
+ error instanceof Error ? error.message : error
3607
+ );
3608
+ return this.convertViaImagePdf(
3609
+ url,
3610
+ reportId,
3611
+ onComplete,
3612
+ cleanupAfterCallback,
3613
+ options,
3614
+ abortSignal
3615
+ );
3616
+ }
3599
3617
  }
3600
3618
  if (options.forceImagePdf) {
3601
3619
  return this.convertViaImagePdf(