Zoo-For-Zotero icon indicating copy to clipboard operation
Zoo-For-Zotero copied to clipboard

Save PDFs annotated by external editors

Open yhtang opened this issue 4 years ago • 15 comments

Hi there.

First, thank you so much for creating this useful app! It has definitely changed the way that I access my Zotero library from my phone.

One feature that I would wish to have for this app is the ability to upload PDF attachments that are annotated using, e.g. Adobe Reader, back to the WebDAV server. Currently, it seems like probably due to the app sandbox feature of Android, if anything such as a highlight is added, a copy of the PDF attachment will be created, while the original file is simply untouched. Ideally, if the edited PDF can be saved back to the bib entry that'll be perfect.

Is there any way that this can be implemented?

Many thanks!

yhtang avatar Oct 07 '20 06:10 yhtang

I would suggest that you use a PDF editor app like Xodo which will write your annotations directly to the file and Zoo should be able to detect those changes and offer to upload.

I would like to add the option to "upload an attachment" in the itemview and that would cover the usecase of uploading changed files from those PDF editors that don't write in place. It's easy enough to do I just need to get around to it.

mickstar avatar Oct 07 '20 16:10 mickstar

Thanks for the prompt reply! I just tried Xodo and it works quite well. Since I don't really have any emotional attachments (:laughing:) to Adobe Reader, I guess the problem is already solved. Of course, if an upload/replace option can be added to the app that'll be even better.

Thanks again!

yhtang avatar Oct 07 '20 16:10 yhtang

Hi,

I have annotated a pdf using Xodo, which saved the changes locally. Zoo didn't seem to notice automatically. When I reopen the entry in Zoo, it informs me that there is a File conflict, and asks me "Would you like to redownload the server's copy?". I want to do the opposite, send the local copy up to the server.

So I chose no, and then scrolled to the bottom of the entry, long-pressed on the pdf, and selected "force re-upload". This failed with a Java error. I didn't write down the details unfortunately.

When I tried to open the entry in Zoo again, it again offered to re-download the file from the server. This time when I pressed "no", it told me it was uploading the file to the server. Which is what I wanted in the first place, so that's good. However, it is a really slow process (which Zoo warned me about) - the little upload symbol displays for several minutes, long enough that the tablet screen goes to sleep. When I reopen the tablet, the upload symbol is gone, but the file hasn't been uploaded, and I can start over.

So far, I have tried variations of this process several times, but haven't yet succeeded in getting my annotated pdf onto the server.

Any ideas?

Thanks for the app, it's fantastic otherwise!

Tyler

Zoo installed from Play Store 20 November 2020 Samsung S6 Lite tablet Sync method Zotero Account Sync Attachments Location External Cache Offer to upload attachments selected

plantarum avatar Nov 20 '20 16:11 plantarum

I am using Xodo on my phone and on my tablet. On my tablet, after changing a file, nothing gets uploaded. I could spot these log lines in adb logcat:

01-12 20:31:06.877  9971  9971 D zotero  : onResume called.
01-12 20:31:06.877  9971  9971 E zotero  : post-resumed
01-12 20:31:06.893  9971 10001 D mali_winsys: new_window_surface returns 0x3000
01-12 20:31:06.903  9971 10001 D mali_winsys: new_window_surface returns 0x3000
01-12 20:31:06.907  9971  9971 D zotero  : RECENTLY OPENED 5DT4CUC4
01-12 20:31:07.192  9971  9971 D zotero  : found change in Percival_Gregory_2020_Architecture patterns with Python.pdf 5DT4CUC4
01-12 20:31:07.192  9971  9971 W DocumentFile: Failed query: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToFirst()' on a null object reference
01-12 20:31:07.192  9971  9971 E zotero  : avoiding uploading a garbage PDF

languitar avatar Jan 12 '21 19:01 languitar

That line prints when the file can't be opened or it's 0 bytes long.

Judging by the null pointer exception it's because the app couldn't open the file.

Are you using external cache or a custom location? And what is the android version and maker of the tablet?

On Wed, 13 Jan 2021, 06:33 Johannes Wienke, [email protected] wrote:

I am using Xodo on my phone and on my tablet. On my tablet, after changing a file, nothing gets uploaded. I could spot these log lines in adb logcat:

01-12 20:31:06.877 9971 9971 D zotero : onResume called. 01-12 20:31:06.877 9971 9971 E zotero : post-resumed 01-12 20:31:06.893 9971 10001 D mali_winsys: new_window_surface returns 0x3000 01-12 20:31:06.903 9971 10001 D mali_winsys: new_window_surface returns 0x3000 01-12 20:31:06.907 9971 9971 D zotero : RECENTLY OPENED 5DT4CUC4 01-12 20:31:07.192 9971 9971 D zotero : found change in Percival_Gregory_2020_Architecture patterns with Python.pdf 5DT4CUC4 01-12 20:31:07.192 9971 9971 W DocumentFile: Failed query: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToFirst()' on a null object reference 01-12 20:31:07.192 9971 9971 E zotero : avoiding uploading a garbage PDF

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mickstar/Zoo-For-Zotero/issues/112#issuecomment-758886619, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAV2V2K2CLZ2FDSZNEZGSLSZSP2FANCNFSM4SG7KP7A .

mickstar avatar Jan 12 '21 21:01 mickstar

It could potentially be an easy fix, https://stackoverflow.com/questions/39963294/attempt-to-invoke-interface-method-int-android-database-cursor-getcount-on-a

are you willing to test a custom APK for me? test build for attachments.zip b210b94af1ce9e14ff2b3172c4d2c2f25b7dbf93

mickstar avatar Jan 12 '21 21:01 mickstar

This is an ancient Nexus 10 with Android 6. If you have an APK to test, I can do that.

languitar avatar Jan 12 '21 22:01 languitar

Yes, it's in the prior post, test build for attachments.zip

Edit: Nevermind this likely won't fix your issue, android 6.0 is too old for this fix.

mickstar avatar Jan 12 '21 22:01 mickstar

:D it's too late tonight. I'll test that tomorrow.

languitar avatar Jan 12 '21 22:01 languitar

Should we continue this discussion in a new issue if you think this is a different bug than the original one?

languitar avatar Jan 13 '21 08:01 languitar

So am I right, that currently if I do some annotations via Zoo, they don't get synced back to my WebDAV storage?

jounathaen avatar Mar 15 '21 20:03 jounathaen

They should be synced. How it works is

  • The app checks for file changes for the last opened attachment
  • If it detects a change, it offers to upload the changed attachment to the served

Step 1 sometimes doesn't happen because people are using pdf editor apps that saves changes to new file, which is why I recommend using Xodo which writes to the existing.

Some people are experiencing other problems though I've not been able to reproduce their error.

mickstar avatar Mar 15 '21 20:03 mickstar

Ah yeah, that might be the problem. Thanks for clarifying

jounathaen avatar Mar 15 '21 20:03 jounathaen

@mickstar It seems it doesn't detect changes the other direction, though?

I.e., the following workflow:

  • Download attachment on Zoo
  • Annotate with Xodo, save
  • See 'Detected changes to attachment', agree to Upload
  • Go back to desktop, sync, make new annotations from desktop, sync
  • Back to Zoo, new annotations aren't there ?

Is there no inverse of 'download PDF from remote to replace local version'?

deklanw avatar Apr 25 '21 20:04 deklanw

Turn on "check attachment integrity"

I stopped checking the attachment's md5 hash before every open (because it was slow) but now it means the app doesn't know if the file is the right version.

On Mon, 26 Apr 2021, 6:03 am deklanw, @.***> wrote:

@mickstar https://github.com/mickstar It seems it doesn't detect changes the other direction, though?

I.e., the following workflow:

  • Download attachment on Zoo
  • Annotate with Xodo, save
  • See 'Detected changes to attachment', agree to Upload
  • Go back to desktop, sync, make new annotations from desktop, sync
  • Back to Zoo, new annotations aren't there ?

Is there no inverse of 'download PDF from remote to replace local version'?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mickstar/Zoo-For-Zotero/issues/112#issuecomment-826381685, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAV2V4RVXRW4NZYDDPYN63TKRYQDANCNFSM4SG7KP7A .

mickstar avatar Apr 25 '21 21:04 mickstar