Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching underlying PDF viewer #36

Merged
merged 14 commits into from
Mar 2, 2017
Merged

Switching underlying PDF viewer #36

merged 14 commits into from
Mar 2, 2017

Conversation

mkoo21
Copy link
Contributor

@mkoo21 mkoo21 commented Dec 21, 2016

Switching the pdf renderer from an old deprecated library to a newer, better maintained library per #34.

Using the newer library will resolve some pixelation issues when zooming in android 6. It also lets you use the Apache License 2.0 rather than GPL.

@andrejunges
Copy link

@mkoo21 is it ready to be used/merged?

@mkoo21
Copy link
Contributor Author

mkoo21 commented Jan 13, 2017

I have been using it for a while now without noticing any issues (android only, since react-native-quick-look takes care of document rendering in ios very well)

@andrejunges
Copy link

I've tested it - and now the app isn't crashing, but nor its rendering the pdf (this behavior only happens for one of the pdf files, but I can open it in other pdf apps or ios).
Im trying now to open it from the URI

@mkoo21
Copy link
Contributor Author

mkoo21 commented Jan 13, 2017

did the old lib work better for you?

@andrejunges
Copy link

nop, I got a crash in that specific file in the old lib (PDF is corrupted..)

@andrejunges
Copy link

any idea/suggestion?

@mkoo21
Copy link
Contributor Author

mkoo21 commented Jan 13, 2017

Haven't run into the issue myself so not really sure what to say. Does it look similar to this issue? If there really isn't anything special about your file maybe ask there and see if you get a better response

@andrejunges
Copy link

Indeed its similar.
I noticed now that the problem is related to the pdf's size.
Files with over 400kb are not opening in here

@andrejunges
Copy link

andrejunges commented Jan 14, 2017

@mkoo21 I finally found the problem.
Actually it was in my code. I passed the file path to my componente before the file creation completes - and once the component's state got that path it renders the PdfViewer..
So it was trying to read the file when it was still creating it (before being closed).
classic IO problem
thanks for the help anyway 👍

@mkoo21
Copy link
Contributor Author

mkoo21 commented Jan 14, 2017

Sure, glad you got it resolved and sorry I wasn't able to help more

@andrejunges
Copy link

image
Any idea why I get this error when I rerender an pdf on Android?

@gyzerok
Copy link
Contributor

gyzerok commented Jan 31, 2017

@mkoo21 @andrejunges any updates about the PR?

@mkoo21
Copy link
Contributor Author

mkoo21 commented Jan 31, 2017

Issue #39 has nothing to do with this PR (you'll get it with the old lib as well), so it's been the same as always

@gyzerok
Copy link
Contributor

gyzerok commented Feb 1, 2017

@mkoo21 can you rebase your fork on top of current master so I can check if it works? And them we can probably ask to merge it.

@mkoo21
Copy link
Contributor Author

mkoo21 commented Feb 2, 2017

done

@gyzerok
Copy link
Contributor

gyzerok commented Feb 3, 2017

@mkoo21 thank you! Will try it next week and report my results.

@aeirola
Copy link

aeirola commented Feb 16, 2017

Nice work, the new PDF rendering library seems to work better. Found a couple of issues though:

  1. The page numbering of the new library seems to be zero-indexed, meaning that a PDF always opens on the second page. Passing the prop pageNumber={0} doesn't help, since there is a check for non-positive page numbers at https://github.com/cnjon/react-native-pdf-view/blob/master/android/src/main/java/com/keyee/pdfview/PDFViewManager.java#L106

  2. The old dependency is still present in the gradle file, causing unneccessary libraries to be loaded in the application. Would be nice if this could be removed.

@gyzerok
Copy link
Contributor

gyzerok commented Feb 16, 2017

@mkoo21 sorry for long response. Here my coworker tried your branch and reported some issues.

@mkoo21
Copy link
Contributor Author

mkoo21 commented Feb 16, 2017

Thanks for the feedback, will take a look when I get home

@gyzerok
Copy link
Contributor

gyzerok commented Feb 22, 2017

Hello @mkoo21! Do you have any updates?

@mkoo21
Copy link
Contributor Author

mkoo21 commented Feb 23, 2017

Yes, sorry, I added some minor changes as requested but haven't really had a chance to test them yet. You are welcome to try these 'unstable' changes if you would like, otherwise I will hopefully get back to you by the end of the week

@aeirola
Copy link

aeirola commented Feb 23, 2017

Thanks for the changes, seem to work nicely. I think we'll take these changes in use in our application. Hopefully they will soon be merged into the main repository too.

@@ -109,7 +109,7 @@ public void setAsset(PDFView view, String ast) {
@ReactProp(name = "pageNumber")
public void setPageNumber(PDFView view, Integer pageNum) {
//view.setPageNumber(pageNum);
if (pageNum > 0){
if (pageNum > -1){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be clearer to do pageNum >= 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can do that if it helps

@gyzerok
Copy link
Contributor

gyzerok commented Mar 1, 2017

@sibelius it seems like we haven't had any issues while using version in this PR. Should we maybe merge it then?

@sibelius
Copy link
Contributor

sibelius commented Mar 1, 2017

@gyzerok could u please upgrade the example project to the latest version of React Native?

So I can test against your branch and merge it

@gyzerok
Copy link
Contributor

gyzerok commented Mar 1, 2017

@sibelius oh, it's not my PR.

@mkoo21 could you, please, do what @sibelius is asking for?

@mkoo21
Copy link
Contributor Author

mkoo21 commented Mar 2, 2017

@sibelius updated example

@sibelius
Copy link
Contributor

sibelius commented Mar 2, 2017

it does look good, thanks for the awesome work

@sibelius sibelius merged commit 0155fd3 into cnjon:master Mar 2, 2017
@sibelius sibelius mentioned this pull request Mar 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants