afreakyelf / Pdf-Viewer

A Lightweight PDF Viewer Android library which only occupies around 80kb while most of the Pdf viewer occupies up to 16MB space.

Home Page:https://afreakyelf.github.io/Pdf-Viewer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loading Progress

cwaliimran opened this issue · comments

Can we have more methods as we have onPdfError()
There should be methods including progress onStartLoading, onLoadedSuccess so we can show and hide progressbar

Thank you for creating your first issue. We appreciate your help in making this project better. We will look into it, and get back to you soon. Need help or want to discuss this issue? Join our Discord community here to ask questions and discuss this issue live!

Hey you can track the progress in onPdfLoadProgress by implementing status listener.

 binding.pdfView.statusListener = object : PdfRendererView.StatusCallBack {
                override fun onPdfLoadStart() {
                    Log.i("statusCallBack","onPdfLoadStart")
                }
                override fun onPdfLoadProgress(
                    progress: Int,
                    downloadedBytes: Long,
                    totalBytes: Long?
                ) {
                    //Download is in progress
                }

                override fun onPdfLoadSuccess(absolutePath: String) {
                    Log.i("statusCallBack","onPdfLoadSuccess")
                }

                override fun onError(error: Throwable) {
                    Log.i("statusCallBack","onError")
                }

                override fun onPageChanged(currentPage: Int, totalPage: Int) {
                    //Page change. Not require
                }
            }

If you need further help, feel free to join https://discord.gg/z9qQSHMxSR for faster help.

It works like a charm. Thank you
If anyone having issue, please consider different versions have different override methods