DImuthuUpe / AndroidPdfViewer

Android view for displaying PDFs rendered with PdfiumAndroid
Apache License 2.0
8.13k stars 1.89k forks source link

Pages are displayed wrongly (compressed pages?) on some documents. #1028

Closed cris16228 closed 3 years ago

cris16228 commented 3 years ago

Hello, I'm having problems displaying pdf files correctly, as you can see the first image is the result I'm getting photo_2021-08-05_22-39-31

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pdfviewer);
    if (core == null)
        core = new Core();
    core.enableFullscreen(getWindow());

    PDFView pdfView = findViewById(R.id.pdf_view);
    path = getIntent().getStringExtra(core.OFFLINE_PATH);
    if (path == null) {
        Uri uri = this.getIntent().getData();
        path = uri.getPath();
    }
    File pdf = new File(path);
    Uri file = Uri.fromFile(pdf);
    pdfView.useBestQuality(true);
    pdfView.fromUri(file).onRender((nbPages, pageWidth, pageHeight) -> pdfView.fitToWidth())).load();
}

And some pdfs are displayed correctly, I want to achieve something like this (Adobe Acrobat Reader): photo_2021-08-05_22-39-32

How can I solve this issue?