ZotFile - Advanced PDF management for Zotero

1353638404163
  • Thanks for reporting! I am traveling and will only get to this next week. Until then, more details would be helpful. What is the location of the file in zoteri? What is the location of the file on the tablet? What is the information in the zotero note (you have to get the html content for "hidden zor zotfile data" or something)?
  • edited January 22, 2015
    My issue is with all PDFs stored using Zotero storage.

    Can you explain the last part of your request?
  • When you click on a pdf in zzoteri, there is a note on the bottom right below the metadata such as filename etc. the note might show the table of content extracted by zotfile. when the pdf is on the tablet, there should be something like "hidden zotfile data" in grey at the end of the note. You have to look at the source code of the note to get that information. Use one of the bottoms to edit the note content (I think it's the last one). Also let me know the path of the file in the file system.
  • edited January 23, 2015
    For example, if I send this attachment to the tablet, this is the hidden HTML content.

    p id="zotfile-data" style="color: #cccccc;" title="{"lastmod":1421173362000,"mode":1,"location":"[BaseFolder]\\Industrial and Organizational Psychology_1_1_52-55_2008_Dalal_Brummel_Wee.pdf","projectFolder":""}"

    The pdf is located here in the file system:
    C:\Users\Brenton\AppData\Roaming\Zotero\Zotero\Profiles\egbkrqal.default\zotero\storage\NICU6QHI\Industrial and Organizational Psychology_1_1_52-55_2008_Dalal_Brummel_Wee.pdf

    Note though, the failure to rename the pdf is not necessarily tied to the tablet functionality. I don't usually use the tablet feature, and the renaming fails whether it is disabled or enabled. This occurs for all pdfs, not just the one I referenced.
  • I checked, and it looks like it's explicitly a problem with commit c08c4d52ba5330ca72b3f7a5e12967b1498139f8

    I reverted this commit, and the problem went away. Renaming began to work correctly
  • What are your wildcards.default and wildcards.user values in about:config?
  • @aurimas

    Thanks for the suggestion! The issue was using "reportNumber" and "" (to create a blank field) in my custom wildcards. Renaming is working now.
  • I am using Zotfile 4.1.1 and cannot extract annotations. Received this error.

    TypeError: anno.color is undefined
    (chrome://zotfile/content/zotfile.js, 3750

    Running Firefox 35.0 on Mac Os X 10.6.8.; Zotero 4.0.25.2.; Zutilo 1.2.10; Poppler 1.1. Poppler is selected for extraction. The PDF producer is: Mac OS X 10.6.8 Quartz PDFContext. PDFs are attached in the default location. The library is not synched.

    Created a Debug ID D1158390013

    I have been using Zotfile for extractions successfully in this configuration. But, recently I updated to the latest version of Zotfile and Zotero when I had to do a complete reset and installation of Firefox. Not sure if that is a factor.
  • This was originally asked in https://forums.zotero.org/discussion/45931/zotfile-411-cannot-extract-annotations-error-3750/#Comment_213856

    and then moved to this forum as directed.

    The answer is that the issue with extractions is related to the update to Zotfile. Extractions work now using pdf.js instead of Poppler.

    To do this: select "Extract Annotations using pdf.js" in the advanced settings of the ZotFile preferences.
  • Okay, just to summarize the issues with the new version.

    bwiernik: When I understand things correctly, your problem with related with user-defined wildcards and not a zotfile bug, right? It's easy to make mistakes with user-defined wildcards. Zotfile does not check whether they are correct at all. That would be good but is not going to happen anytime soon.

    EileenClancy: I think I know what the problem is and already fixed it. The development version on github includes the changes and I will submit as soon as the other problems are fixed. Until then, you can switch to pdf.js-based extraction, which is much better than it used to be and often outperforms the poppler-based extraction.

    pchrapka: Do you still have the same problem? Can you report more details? Seems to be unrelated to bwiernik's issue.
  • My issue was one with user-defined wild cards. The change to base fields broke some behavior that previously worked. Not a Zotfile bug that needs to be fixed at this point, I don't think.
  • Dear Joscha,

    The renaming rule of zotfile is very useful but I want to set the wildcards options as only first pages.

    Here is the example..
    {%s_}{%y_}{%v_}{%f_}{%F}

    Carbon_2013_53_286-291_TanX.pdf

    Is there any method to rename only first page like this?
    Carbon_2013_53_286_TanX.pdf
  • Dear Joscha,

    Thanks for an amazing tool. I have a feature request: it would be great to have an option to choose what to extract (underlined citations, or only notes) from PDFs.
    I don't know how the fdf stuff in pdf-annotations is structured, so this might not be possible...

    Regards
    David
  • NodoLee, you can probably do that with user-defined wildcards: http://zotfile.com/#user-defined-wildcards
    Be careful thought. It's really an advanced feature and it's easy to make mistakes.

    grbr, that wouldn't be very hard to implement but I won't get to it anytime soon. I am open to pull-requests though.
  • i get the error whenever i try to send/get to tablet. i dug in a bit and it only happens with pdfs that were sent to my tablet before a certain date (around 9/17/2014).

    Working version:
    lastmod{1414087374000}; mode{1}; location{[BaseFolder]/@To Skim/Kokkala_Särkkä - 2014 - Combining Particle MCMC with Rao-Blackwellized Monte Carlo Data Association for.pdf}; projectFolder{/@To Skim}

    Problem:
    lastmod{1410990675235}; mode{1}; location{[BaseFolder]\@To Skim\Whitfield-Gabrieli, Nieto-Castanon - 2012 - Conn.pdf}; projectFolder{\@To Skim}

    seems like the path is the issue, just the last slash before the file name. this is the error i get for the last one:
    Zotfile Error
    Unknown error!

    Zotfile Error
    The file "/home/phil/Dropbox/Papers/@To Skim\Whitfield-Gabrieli, Nieto-Castanon - 2012 - Conn.pdf" does not exist
  • Thanks for the detailed reporting. I think I fixed it on github. Can you try that version? You have to manually install it. If you have both a windows and mac or linux machine it would also be great if you can try send files on windows and get them back on mac. Let me know whether the change fixes the problem and I will submit the version.
  • edited February 1, 2015
    Hi,

    First of all (and let us not forget) thanks for a fabulous add-on, makes my life so easy!

    Now, for a fairly major problem with exporting attachments to tablet using 4.1.2 (updated to 4.1.3 from GitHub but same problem persists) as reported by pchrapka above. I export with Zotero subcollections as folders.

    The problem manifests itself by the fact that empty folders with the name of the PDF file (which is not exported) is created for random files. So if I want to export a file "Jones - Title of paper (2013)" (this is my format) I get an empty folder with this name, and no PDF file inside it, or at the same level.

    If I retry the export (without resetting anything), it will often work! But then some other files in another subcollection will fail later.

    If I remove the _tablet tag and delete all files/folders in the export folder, and try again from scratch it is not always the same files that fail! For instance, I had a Zotero subcollection with 31 attachments, first attempt 2 failed, second clean attempt, 3 failed, two of the same plus one other attachment. In another folder the same attachment failed repeatedly, and in a third it worked the second time for all. So quite strange...

    This is all on a new install of ZotFile, but all these files exported without problem on my older laptop using an older version of ZotFile...

    So, 4.1.3 is not quite there yet...

    Let me know if I can do more to help find the problem

    A
  • Hi, I can't reproduce this despite trying multiple times. Is there an error message under Preferences -> Report Error? Can you pin down when the problem occurs? Can you try past versions step by step to see when the problem occured? https://github.com/jlegewie/zotfile/releases

    Otherwise it's hard to do something about it.
  • Hey Joscha,
    I tried 4.1.3 on linux and it solved my problem. Thanks for looking into this!
  • edited February 16, 2015
    I am using Ubuntu 14.04, Zotfile 4.1.3, Zotero 4.0.26.
    I changed the renaming preference of Zotfile to this {%t}{_%a}{_%y}, but when I click "Rename file from parent metadat", it only renames to this format: {%a-}{%y-}{%t}. I have never set up this format anywhere but it's always doing this.
    Although when I click "Update" button in Zotfile preference, it's showing the correct format.
    I tried uninstalling and re-installing all. Same thing happens.
  • Make sure the "Use Zotero to rename attachments" box is not checked.
  • @Joscha, in reference to the problem I reported, Feb 1st 2015, exporting files not working, I found the bug.

    Basically, it happens if you have an attachment that has not *already* been renamed to the Zotfile format specified when you try to save it to a tablet. In my case I use two computers and sync via the paid Zotero option, and on the second computer I have not installed Zotfile. What seems to happen is that Zotfile stores the the non-renamed filename, then renames it, and then tries to copy the file with the original filename, not the renamed file.

    Have a look at two screenshots I put in this file: http://bergh.fm/zotero.jpg

    Should be simple to fix I guess :-)

    A
  • @bwiernik
    Yeah I checked. It's unchecked.
  • Ok. I got what is happening. It's always choosing the default option to rename even if I unselected Zotero to rename. I checked from about:config. There also, zoterotorename is set false. However, I don't know how to fix it!
  • What option in the right-click menu are you choosing to rename your files? It needs to be "Rename Attachment" under the "Manage Attachments" not the "Rename from Metadata" (that's the default Zotero option)
  • Okay. I tried that option. I got some NS_FILE_ERROR. That's because I didn't specify any location to move the file. If I specify location to move the file, then I can't have the file in the actual location I had previously. That's not what I want. If I select "Attach store copy", then also the file is moved to some random location in my disk within .zotero folder. I want the file to be renamed in-place where that actually is located.
    I solved the problem by editing the code. Here's my patch. https://github.com/sohamm17/zotfile/commit/2f433a43cea374bc82bd196e6d9f66c25ee804d9
    I don't know if it will be accepted or not. However, I think we should allow people to rename file in-place.
  • Hi,
    Does someone could help with regex? (I hate writing those things...)
    So I want
    a) Having a 2-digits year
    I got my 2 last digits by
    "function": "replace",
    "regex": "[0-9]{2}([0-9]{2})",
    "replacement": "$1",
    "flags": "g"

    But my problem is that I still have day and month printed. How I remove it?

    b) Remove completely space in publication title.
    I found this regex in internet, but doesn't work for me
    "function": "replace",
    "regex": "(/ /g, '')",


    Thanks and sorry for my knowledge's lacks...
    Mel
  • Try using "exec" instead of "replace" on field "date" (I'm not sure if "year" is available for user defined functions). Use "\\b\\d{2}(\\d{2})\\b" as regexp and group: "1". You don't need the "g" flag, nor does it make sense for "exec" in this case.
  • For (b) you just need to format it the way you did in (a). I'd use "\\s" for regexp though. replacement should be ""
  • Thanks Aurimas!
    So I copy here the final result, in case someone else is interested to those renaming personnalization.


    "6": {
    "field": "date",
    "operations": [
    {
    "function": "exec",
    "regex": "\\b\\d{2}(\\d{2})\\b",
    "group": "1"
    }
    ]
    },
    "7": {
    "field": "journalAbbreviation",
    "operations": [
    {
    "function": "replace",
    "regex": "\\s",
    "replacement": ""
    }

    Mel
This discussion has been closed.