saber-notes / saber

The cross-platform open-source app built for handwriting
https://saber.adil.hanney.org
GNU General Public License v3.0
2.31k stars 152 forks source link

App crashes when importing pdf with pages of different aspect ratios #588

Open NicholasLam12 opened 1 year ago

NicholasLam12 commented 1 year ago

Describe the bug

When trying to import a pdf file containing pages of different aspect ratio (usually scanned documents), the app crashes without importing anything.

To reproduce

  1. Create a new note
  2. Click the three dots to open the menu
  3. Click the PDF button in the import section
  4. Select a pdf file containing pages of differing aspect ratio
  5. The app crashes

Expected behavior

The pdf should import(maybe with some stretching of some of the pages) without crashing the app.

Saber version

v0.11.4 Google Play (11040)

Device

Anything else?

I have no idea how any of these works in the background, but perhaps when encountering these pdf files, treat each page as an individual image and then stretch the image along the longer axis to fill the background?

adil192 commented 1 year ago

Please can you upload/send a link to such a PDF?

NicholasLam12 commented 1 year ago

Like this one https://file.io/7Nb2wmlVgRCm

adil192 commented 1 year ago

Confirming I can reproduce this issue on my Android phone but not my macOS laptop

Lokawn commented 1 year ago

Both Flatpak and android apps crash for me while importing any pdf longer than 3-4 pages, irrespective of presence or absence of page size difference. I am using SD 778G+ on android which I think is a decent processor, still the app crashes.

I imported a two page pdf, it takes a lot of time to import, PDF's colours were inverted and when I reversed the inverted flag it changed only first pages' colours.

On exporting PDFs quality is worsened, OCR is lost. Is there any option to prevent this or some setting I am missing, asking since others are able to open PDFs?

adil192 commented 1 year ago

On exporting PDFs quality is worsened, OCR is lost. Is there any option to prevent this or some setting I am missing, asking since others are able to open PDFs?

See: