'Flutter / Android PDF viewer is low quality
I am making a flutter app to view PDF files.
I have tried a bunch of different packages (native_pdf_view, flutter_cached_pdfview, uc_pdfview), and it seems like they all result in a somewhat low-quality render.
When I look at the same file using Google Drive's PDF Viewer, the quality is significantly improved. Is there an antialiasing setting I'm missing somewhere that would improve the PDF rendering performance?
Zoomed in screenshot showing the poor antialiasing with native_pdf_view:

Zoomed in screenshot showing the same file using Google Drive:

Any advice on how to improve the rendering of the PDF would be much appreciated. The relevant section of code for the PdfView widget is below. (If I increase the 'width' and 'height' parameters, the quality looks slightly better, but still nowhere near the quality of Google Drive, yet soon runs out of memory)
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',
),
))
Edit: Here is the source PDF file used in these screenshots (although other music PDF files also show the same lower quality rendering): https://www.free-scores.com/PDF_EN/chopin-frederic-prelude-15-296.pdf
This PDF uses a font to display the music ( https://lilypond.org/doc/v2.18/Documentation/notation/the-feta-font ).
Solution 1:[1]
I succeeded to resolve the problem of low quality by increasing the width and the height attributes in page.render and by giving quality a value of 100. Here is a snippet of my code:
renderer: (PdfPage page) => page.render(
width: page.width * 5,
height: page.height * 5,
format: PdfPageImageFormat.jpeg,
backgroundColor: '#FFFFFF',
quality: 100,
),
Note: use the last version of the native_pdf_view package because format: PdfPageFormat is no longer supported. Now it uses PdfPageImageFormat instead of PdfPageFormat.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | AZED |
