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

Add Bookmarks index for imported PDFs #31

Open
sancho-s opened this issue Mar 19, 2023 · 10 comments
Open

Add Bookmarks index for imported PDFs #31

sancho-s opened this issue Mar 19, 2023 · 10 comments

Comments

@sancho-s
Copy link

sancho-s commented Mar 19, 2023

For a Zotero item, whenever I add a pdf file in disk (either the file or a link to it), the tag structure of the pdf is read, and it is shown as an hyperlinked table of contents, so clicking on it opens the pdf at the location of the item.

But when I add Zotero items via [zotero-folder-import], the table of contents is not added.
Can this be done?

Thanks!

@retorquere
Copy link
Owner

I don't know this functionality. Where does this table of contents show up?

@sancho-s
Copy link
Author

sancho-s commented Mar 20, 2023

In Zotero, if you select an item, expand its attachments, and select a pdf attachment that was added via "Attach link to file", in the right hand panel you will see:

  • The name of the file
  • Filename: <filename> (yes, again!)
  • Modified: <dale-time>
  • Indexed: <status>
    And if the table of contents exists, it will show right below this.
    Of course, the original pdf has to have that.
    I am not sure which are all possible ways to obtain this table.

@retorquere
Copy link
Owner

Do you have a sample pdf known to trigger the desired behavior?

@sancho-s
Copy link
Author

sancho-s commented Mar 20, 2023

Yes, I am attaching it here.
Buckling.pdf

PS: I found that, in Zotero, you may or may not get the table of contents, depending on how you add the pdf attachment to the Zotero item. If added via "Attach link to file", the table is created.

image

If added via Ctrl+Shift+drag, it is not. This is reported in a related thread in Zotero forum.

So, I guess there are two ways in which [zotero-folder-import] can get the table:

  1. By Zotero changing the behaviour of Ctrl+Shift+drag, and then that will be replicated in the add-on.
  2. By the add-on mimicking the behaviour of "Attach link to file" instead.

@retorquere
Copy link
Owner

According to that thread, the TOC thing is a Zotfile feature, so you would have to ask there why it isn't being generated. folder-import is calling the same functions that Zotero itself calls when importing/linking attachments.

@sancho-s
Copy link
Author

sancho-s commented Mar 20, 2023

I don't know about the interaction Zotero-Zotfile, and I am not even sure extraction of the table of contents is done by Zotfile or Zotero itself. For instance, apparently, since Zotero 6.0, extraction of annotations is not done by Zotfile anymore, but by Zotero.

At any rate, what I mean is that, apparently, Zotero has two different ways of attaching a PDF, and they perform differently:

  1. Via Ctrl+Shift+drag of the PDF into the Zotero item.
  2. Via menus and "Attach link to file". This creates the table of contents.

Perhaps [zotero-folder-import] can be instructed to work like #2, regardless of that being directly with Zotero or via Zotfile.

@retorquere
Copy link
Owner

If adamsmith says that this is done by Zotfile I'm inclined to believe him. Can you first go check whether @jlegewie agrees with adamsmith before I dive into the Zotero code? If it's Zotfile's feature to do this I'll be glad to help where needed, but would prefer to keep @jlegewie in the lead for it. If it is indeed not a Zotfile feature but something Zotero does itself, that would be a different matter.

@sancho-s
Copy link
Author

Will do. On a separate note, now using Ctrl+Shift+drag does get the table of contents.
I can't reproduce what I saw before.

What I can reproduce is that adding via [zotero-folder-import] does not get the table of contents. Which, on a file-by-file basis, can be fixed via Select the PDF item -> Right click -> Manage Attachments -> Get table of contents.

Summarizing, it seems that now [zotero-folder-import] does not do exactly the same a Zotfile... which is very strange.

@retorquere
Copy link
Owner

What is zotero's behavior if you don't have Zotfile installed?

@retorquere
Copy link
Owner

What I can reproduce is that adding via [zotero-folder-import] does not get the table of contents. Which, on a file-by-file basis, can be fixed via Select the PDF item -> Right click -> Manage Attachments -> Get table of contents.

Summarizing, it seems that now [zotero-folder-import] does not do exactly the same a Zotfile... which is very strange.

As soon as @jlewegie weighs in, I can see what to do about this (or whether there is anything to do). I do not know what initiates this behavior, and adamsmith, who is deeply involved with Zotero, says it is Zotfile doing this.

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

No branches or pull requests

2 participants