packages.flutter icon indicating copy to clipboard operation
packages.flutter copied to clipboard

native_pdf_view results in a low quality image

Open wasik opened this issue 3 years ago • 3 comments

Describe the bug When opening up a PDF file that contains sheet music (for example, this public domain PDF: https://www.free-scores.com/PDF_EN/chopin-frederic-prelude-15-296.pdf ), the the quality is only mediocre, making it slightly difficult to see what note is where at times.

It's possible this is a problem with a vector PDF that's rendered at a higher resolution (eg. height * 2, width * 2), and then downscaled to fit on the screen. It looks like there's a FilterQuality parameter that can be passed to PhotoView ( https://pub.dev/documentation/photo_view/latest/photo_view/PhotoView-class.html ) - perhaps exposing that would allow this PDF to look closer to Google Drive when it's displayed?

To Reproduce Open up this PDF file in a Flutter app using native_pdf_view and notice it's blocky/pixellated (see the screenshot with a couple of the problem areas circled) https://www.free-scores.com/PDF_EN/chopin-frederic-prelude-15-296.pdf

PdfView(
            documentLoader: Center(child: CircularProgressIndicator()),
            pageLoader: Center(child: CircularProgressIndicator()),
            controller: _pdfController,
            renderer: (PdfPage page) => page.render(
              width: page.width * 2,
              height: page.height * 2,
              format: PdfPageFormat.JPEG,
              backgroundColor: '#FFFFFF',
            )
)

Increasing the *2 to *4 makes it look slightly better, but still not the same quality as Google Drive. When increasing the multiplier beyond that, the app uses too much memory.

Expected behavior The PDF should have roughly the same quality as when using other android apps, eg. Google Drive, to open the PDF

Screenshots Sample screenshot from a device using native_pdf_view: native_pdf_view

Sample screenshot from the same device opening the same file in Google Drive: google_drive

Smartphone (please complete the following information):

  • Device: Samsung Galaxy Tab S6
  • native_pdf_view version 5.0.0

wasik avatar Jan 09 '22 19:01 wasik

as the same. when opening pdf at Huawei T3 tablet(800x1280, 9.6inches, Android 7.0), the bottom of words was crushed slightly. I created a simulator to reproduce it.

rex26 avatar Jan 29 '22 07:01 rex26

Any update on this? I know it was only open 26 days ago, but it would be nice to have some feedback.

FeltesPT avatar Feb 04 '22 17:02 FeltesPT

The way I "fixed" it was using PdfViewPinch instead of PdfView.

bodoczky avatar Mar 18 '22 17:03 bodoczky