Files
zeekayandHanzo Dev d15022d194 fix(pdf): tear a pdf.js document down through its loading task
pdfjs-dist went from 5 to 6 and PDFDocumentProxy lost destroy(). In 5 it
was one line, `return this.loadingTask.destroy()`, so the task is what
there is to destroy. Three calls were left:

- pdfToImages called it after rendering. The call threw before its .catch
  could attach, so every render ended in "pdf.destroy is not a function"
  and the AI features that read a document got nothing. The task it also
  destroyed is the same task, so that call is the one kept.
- The PDF viewer called it when a new document replaced an old one, inside
  the load's try, so switching documents showed the load error; and in the
  effect's cleanup. Both now destroy the loading task, as 5 did for them.

pdf-to-images.test.ts renders a two-page PDF and checks each page comes
back as a letter-size JPEG in order; against the old code it fails with the
TypeError.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-19 04:31:23 -07:00
..