barteksc / androidpdfviewerv1 Goto Github PK
View Code? Open in Web Editor NEWAndroid view for displaying PDFs rendered with PdfiumAndroid
License: Apache License 2.0
Android view for displaying PDFs rendered with PdfiumAndroid
License: Apache License 2.0
We ran into an issue posted on Rollbar and figured out it's happening when the PDFView zoom animation is, playing due to a double tap, and the user dismisses the PDFView. Our parent view, which is a Dialog
-based class, contains a button to close the PDFView and Dialog. The user can also click the Back button to do the same action.
We fixed this by overriding our onBackPressed()
in the parent Dialog as well as that dismiss button and checking if the view PDFView.isZooming()
If it is, we PDFView.resetZoomWithAnimation()
instead of dismissing.
I'm posting it here just in case maintainers would like to enhance the PDFView to avoid the crash. If you don't see this as an issue, feel free to close, or let me know if you'd like me to close it.
Thanks,
Anthony
implementation 'com.github.barteksc:android-pdf-viewer:1.6.0'
implementation 'com.github.barteksc:pdfium-android:1.9.0'
java.lang.NullPointerException: Attempt to read from field 'long com.shockwave.pdfium.PdfDocument.mNativeDocPtr' on a null object reference
1 at com.shockwave.pdfium.PdfiumCore.openPage (PdfiumCore.java:166)
2 at com.github.barteksc.pdfviewer.PDFView.loadPage (PDFView.java:706)
3 at com.github.barteksc.pdfviewer.PDFView.loadPages (PDFView.java:664)
4 at com.github.barteksc.pdfviewer.AnimationManager$ZoomAnimation.onAnimationEnd (AnimationManager.java:153)
I have implemented this pdfviewer. It is working fine but when I scroll the scrollbar, it is not showing page number. I have tried everything on the internet but issue is still not solved. Please help.
Does this one support direct viewing from the url?
Hai, is this latest version able to load pdf files from url?
I am attempting to open a file with a size of 76MB, and upon using this library, my application displays an ANR (Application Not Responding) dialog.
is there no option to show watermark ?
if i have zoomed page then page change using swipe is not working. any solution ?
How do I use this without using a layout.xml?
for example, with Android's own TextView
, we can do the following -
TextView textView = new TextView(context);
(Because, there, the AttributeSet object is optional.)
But cannot seem to do the same with PDFView
, because it's constructor requires an AttributeSet set
object as it's the second argument, and I have no idea where to get that from...
public PDFView(Context context, AttributeSet set) {
Why though?
I need to use it this way, in order to create a Flutter AndroidView
, which will enable this library to be used from flutter as a widget!
Hi, I am trying to use PDFViewer inside a RecyclerView as my requirement is to render multiple PDF files consisting single page each. The pages are rendered perfectly for the first time, but when I scroll to bottom of RecyclerView and again scroll back to previous pages then I am getting blank views. Can anyone suggest me a way to overcome this and let me know if I am trying to do it in an wrong way. Any help is appreciated, thanks.
Crash 1:
java.lang.NullPointerException:
at com.github.barteksc.pdfviewer.PDFView.loadPages (PDFView.java:651)
at com.github.barteksc.pdfviewer.PDFView.onSizeChanged (PDFView.java:481)
Crash 2:
java.lang.NullPointerException:
at com.shockwave.pdfium.PdfiumCore.openPage (PdfiumCore.java:134)
at com.github.barteksc.pdfviewer.PDFView.loadPage (PDFView.java:706)
at com.github.barteksc.pdfviewer.PDFView.loadPages (PDFView.java:664)
at com.github.barteksc.pdfviewer.AnimationManager$FlingAnimation.onAnimationEnd (AnimationManager.java:182)
pdfView.onPageChange() method is called every time when I shake/move page...
it's a very big issue for me
When page will fully change then this method should to call otherwise not...
This is required to drawn pins over the documents based on coordinates, I'll be making a PR
I have the pdf like this
---------
| |
| | -----------
| | | |
------- | | | |
| | | | | |
| | | | | |
------- | | | |
| | | |
| | -----------
| |
| |
---------
And so on, but i want to display it like according to width of my phon.
------- -------- --------
| || || |
| || || |
------- || || |
|| || |
|| |--------
|| |
--------
Is there any solutions?
could you please tell me how to make swipe from the other side?
Trying to do
.onRender { _, _, _ -> pdfView.fitToWidth() }
and I get the error "Type mismatch: inferred type is (Int, Any?, Any?) -> Unit but ((Int) -> Unit)! was expected"
Hi @barteksc ,
In general PDF contains more papers, in my case I am rendering single page with <com.github.barteksc.pdfviewer.PDFView>
I am displaying Each PDF file in Recyclerview using Adapter, so I can do load more for each pdf file it makes user comfort of rendering of pdf files.
While I m scrolling down the property of recyclerview is reusing the the views so at that time Pdfium core is distroyed and it is not at all rendering in scrolldown.
Here is logcat:
D/Error: 480.0
02-09 15:42:12.534 20576-20576/com.self.pdf_poc D/Error: 480.0
02-09 15:42:12.582 20576-20576/com.self.pdf_poc D/Error: 480.0
02-09 15:42:12.614 20576-20576/com.self.pdf_poc D/Error: 480.0
02-09 15:42:15.054 20576-20576/com.self.pdf_poc D/jniPdfium: Destroy FPDF library
02-09 15:42:20.513 20576-20576/com.self.pdf_poc D/AndroidRuntime: Shutting down VM
02-09 15:42:20.529 20576-20576/com.self.pdf_poc E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.self.pdf_poc, PID: 20576
java.lang.NullPointerException: Attempt to read from field 'long com.shockwave.pdfium.PdfDocument.mNativeDocPtr' on a null object reference
at com.shockwave.pdfium.PdfiumCore.openPage(PdfiumCore.java:134)
at com.github.barteksc.pdfviewer.PDFView.loadPage(PDFView.java:706)
at com.github.barteksc.pdfviewer.PDFView.loadPages(PDFView.java:664)
How can I achieve my solution. Please let me know it's urgent
Thanks
max zoom level not worked if pdf is zoomed using pinch gesture.
Sometimes I have to drag the page from right to left through all the screen width slowly to get the next page and if I stopped in between or started from the center of the screen it doesn't switch pages, is there any improvements for that?
Can we search keywords on pdf files. Do you support search.
<com.github.barteksc.pdfviewer.ScrollBar
android:id="@+id/scrollBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:sb_horizontal="true"
android:layout_alignParentBottom="true" />
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.