sioyek icon indicating copy to clipboard operation
sioyek copied to clipboard

Annotations

Open IsaacDLS opened this issue 3 years ago • 14 comments

It would be nice if it has annotations like Adobe Reader/Okular.

IsaacDLS avatar Sep 20 '21 05:09 IsaacDLS

What kind of annotations do you mean? We have bookmarks which are kind of like text comments and we have highlights. Also if you mean annotations that modify the PDF itself and are visible in other PDF viewing software, we probably will never have those because of the reasons explained here: https://github.com/ahrm/sioyek/issues/38#issuecomment-916107614 .

ahrm avatar Sep 20 '21 09:09 ahrm

What kind of annotations do you mean? We have bookmarks which are kind of like text comments and we have highlights. Also if you mean annotations that modify the PDF itself and are visible in other PDF viewing software, we probably will never have those because of the reasons explained here: #38 (comment) .

Maybe in the future one can create an external tool/plugin that will merge the highlights and the PDF file to generate another PDF with highlights/annotations included.

A3EKV avatar Sep 20 '21 11:09 A3EKV

What kind of annotations do you mean? We have bookmarks which are kind of like text comments and we have highlights.

Inserting lines, shapes, and signatures

Also if you mean annotations that modify the PDF itself and are visible in other PDF viewing software, we probably will never have those because of the reasons explained here: https://github.com/ahrm/sioyek/issues/38#issuecomment-916107614 .

Noted on this. Maybe having an option to print it on pdf would be a good workaround if someone wants to "flatten" the annotations on the pdf.

Anyways, thanks for the response.

IsaacDLS avatar Sep 21 '21 00:09 IsaacDLS

We have bookmarks which are kind of like text comments.

what about showing bookmark content near the bookmark anchor? @ahrm Currently, I can hardly be aware that I used to make a bookmark here if I review the paper several days later.

Creling avatar Nov 24 '21 05:11 Creling

What kind of annotations do you mean? We have bookmarks which are kind of like text comments and we have highlights. Also if you mean annotations that modify the PDF itself and are visible in other PDF viewing software, we probably will never have those because of the reasons explained here: #38 (comment) .

can sioyek put the config data in the same directory with the PDF files? or replace the absolute file path with relative one when exporting configs ?

runtimeee avatar Dec 15 '21 16:12 runtimeee

What kind of annotations do you mean? We have bookmarks which are kind of like text comments and we have highlights. Also if you mean annotations that modify the PDF itself and are visible in other PDF viewing software, we probably will never have those because of the reasons explained here: #38 (comment) .

can sioyek put the config data in the same directory with the PDF files? or replace the absolute file path with relative one when exporting configs ?

No, what does it even mean for config data be in the same directory as the PDF files? PDF files might be in different locations.

ahrm avatar Dec 15 '21 18:12 ahrm

well, the macOS app Skim created next to every .pdf file a corresponding .skim file with the annotations included. I wonder whether this could be implemented with sioyek, as currently the cooperation between shared.db files and embed_annotation command is not very functional across Win/Linux :-(

alfureu avatar Jul 01 '22 08:07 alfureu

This is a nice pdf viewer, with a lot of useful functionalities for researchers.

However, I would say without a convenient way to store annotations inside the pdfs, I cannot adopt this viewer. This design is exclusive. If you use this viewer to annotate a pdf, you cannot use another pdf viewer to read the same pdf, because the annotations are not along with the file. I cannot see the much benefit of this decision.

Anyway, I still think this is a great project.

linwaytin avatar Jul 18 '22 02:07 linwaytin

For the record, it is possible to embed all annotations in the PDF file using the embed_annotations command. However, keeping the annotations in a separate database files has many advantages and is key to the design of sioyek, so it is unlikely that we ever change that, here are some of the advantages:

  • Can be used when you don't have write permission on the PDF files
  • All your data can easily be synchronized by just sharing one database file
  • You can globally search all annotations on all files very quickly

ahrm avatar Jul 18 '22 08:07 ahrm

Well, allow me to comment on these points. As researchers, we often use multiple computers with various shared accounts (Dropbox, OneDrive, Sharepoint, etc). Even if one tries to use a shared.db, the paths would be different for every client, so this is causing a bit of difficulty to set up for every single individual client and maintain it consistently. I tried to set up Windows 10 and Fedora, in the latter finding the correct path was quite a journey.

Often on multiple machines we are forced to use shared reference manager files as well (bibtex). The reference manager file takes care of the keywords, comments, but also can search in full-text. So no need for a 3rd point in most of the cases. However, what is really really p*ssing me off is that I cannot embed annotations into the same file I am reading, it needs to be saved into a different one. This breaks the link with the reference file... however good is sioyek, until this behaviour pertains it is 100% unusable for me and most of us with organized reference management.

This also makes it impossible to import already annotated PDFs, as the shared.db does not see the annotations. Migration to sioyek then is a problem.

We researchers often need to share our datasets (open science), share our annotations for literature reviews across multiple teams. Sharing highlights easily is absolutely crucial for 21st century science. Thus, the annotations should not migrate in a database, but rather with the PDFs.

Back to your 1st point: I mean seriously, who does not have access to their PDFs? Why would you comment on a PDF to which you do not have write access to? Then make a copy first and then annotate.

alfureu avatar Jul 18 '22 08:07 alfureu

Even if one tries to use a shared.db, the paths would be different for every client

Well, that is another advantage of not modifying PDF files! Because we don't change the files, we can use the hash of the file as a unique identifier. So it doesn't matter if the paths are different, it should still work (you just need to open the file once using sioyek so that it knows it exists).

Back to your 1st point: I mean seriously, who does not have access to their PDFs? Why would you comment on a PDF to which you do not have write access to? Then make a copy first and then annotate.

Here is a comment from when I shared sioyek for the first time on hackernews about a year ago (and this was before we has any annotations):

Annotations are super useful. Please consider storing the annotations external to the PDF. For example, Okular wants to save these to the PDF itself. This doesn't work very well with a read-only network drive (read: corporate environment).

Anyway, I am not dismissing your issues (that is why we have the embed_annotations command), however at this point it is too late to change the way that we are storing annotations even if I wanted to.

ahrm avatar Jul 18 '22 08:07 ahrm

Well then allow the following:

  1. a setting to embed_annotations on the fly, as soon as one annotates, it is immediately embedded
  2. allow to save into the same file by default - I don't understand why do we need to maintain the consistency of a PDF? Very few viewers allow editing PDFs, corporate environments can handle this differently with RO access

These two optional settings would already address our concerns, and those with reference managers and linked files (e.g. JabRef and alike)

alfureu avatar Jul 18 '22 08:07 alfureu

Like I said, it is pretty important for sioyek not to modify PDF files so I won't add this to the main sioyek source code. However, what you want can be achieved using the external script system. I made a simple script that does what you want here: https://github.com/ahrm/sioyek/blob/main/scripts/embedded_annotations.py

Here is how it looks like:

https://user-images.githubusercontent.com/6392321/180283893-85b94515-aeb3-42fa-9279-e7054f282c1a.mp4

ahrm avatar Jul 21 '22 18:07 ahrm

This looks great! I will try it once I have time. Thanks for implementing this feature.

linwaytin avatar Jul 21 '22 22:07 linwaytin

Like I said, it is pretty important for sioyek not to modify PDF files so I won't add this to the main sioyek source code. However, what you want can be achieved using the external script system. I made a simple script that does what you want here: https://github.com/ahrm/sioyek/blob/main/scripts/embedded_annotations.py

Here is how it looks like:

Is this in version 2.0 now? I tried the code on mac but it is not working.

x61 avatar Mar 06 '23 23:03 x61

Yes, you need to install the python extensions.

ahrm avatar Mar 06 '23 23:03 ahrm

Thanks for writing this. It didn't work on my computer so I changed the script a bit to make it work.

Is there no way to see the annotation in sioyke?

nickel8448 avatar Aug 31 '23 10:08 nickel8448

Is there no way to see the annotation in sioyke?

Not currently.

ahrm avatar Aug 31 '23 11:08 ahrm

In the development branch we have added:

  • Underline and strikethrough highlights
  • Visible bookmarks
  • Freetext bookmarks
  • Freehand drawings
  • Ability to export annotations with a built-in command (no extension required)
  • Ability to import PDF annotations with a built-in command

ahrm avatar Jan 26 '24 13:01 ahrm

Looking forward to the new features!

linwaytin avatar Jan 26 '24 15:01 linwaytin

In the development branch we have added:

* Underline and strikethrough highlights

* Visible bookmarks

* Freetext bookmarks

* Freehand drawings

* Ability to export annotations with a built-in command (no extension required)

* Ability to import PDF annotations with a built-in command

when it will land in stable/main branch? we all are waiting

Aneeqasif avatar Jan 29 '24 02:01 Aneeqasif

The ability to add comments to highlighted text, or a selected region, in a small pop-up window would be very useful (in my case for language learning, being able to highlight a word and include a translation which I can read when I click the highlight). Most of the PDFs I'm working with are poorly scanned and in old scripts. Would this be trivial to add?

mithryl avatar Mar 26 '24 18:03 mithryl

This is already added in the development branch.

ahrm avatar Mar 27 '24 08:03 ahrm

This is already added in the development branch.

that's great. can you please suggest what changes in the aur pkgbuild need to be make to get the dev package. i have tried but failed if you can give a aur pkgbuild recipe it will be great at least for arch users for building and testing the software. thanks

Aneeqasif avatar Mar 27 '24 11:03 Aneeqasif

I don't recommend publishing a package with the dev build yet. It is still under development and may be incompatible with the final release version.

ahrm avatar Mar 27 '24 12:03 ahrm

I don't recommend publishing a package with the dev build yet. It is still under development and may be incompatible with the final release version.

then how the people who want fixes or new features would get them. at least have a beta package for testing purposes only

Aneeqasif avatar Mar 27 '24 12:03 Aneeqasif

I am not on arch so I don't know the exact modifications needed to build the dev branch. The instructions in README do work (I have tested them on windows, linux (ubuntu), and mac) the only difference is that you need qt 6.6 instead of 5.*.

ahrm avatar Mar 27 '24 15:03 ahrm

that's great. can you please suggest what changes in the aur pkgbuild need to be make to get the dev package. i have tried but failed if you can give a aur pkgbuild recipe it will be great at least for arch users for building and testing the software. thanks

The current sioyek-git package in the AUR is using the development branch and compiles fine.

This is already added in the development branch.

Awesome, that's exactly what I was looking for. One issue, though: I see that I can add comments to highlights now, but there is text that I can't highlight due to the PDF being a scan. The text isn't selectable. I'd like to be able to do a rectangular selection which has this same functionality as a normal highlight—namely, being able to add a comment to the highlighted area/box and then view that comment when I click on it. Is this functionality added?

mithryl avatar Mar 28 '24 02:03 mithryl

The current sioyek-git package in the AUR is using the development branch and compiles fine.

Oh boy. I would like to warn people that when the next version of sioyek is released, it likely will be incompatible with the data saved in the development branch. Now it probably will be possible to move the data by slightly modifying and renaming the database files, but I just want people to know what they are getting into.

Awesome, that's exactly what I was looking for. One issue, though: I see that I can add comments to highlights now, but there is text that I can't highlight due to the PDF being a scan. The text isn't selectable. I'd like to be able to do a rectangular selection which has this same functionality as a normal highlight—namely, being able to add a comment to the highlighted area/box and then view that comment when I click on it. Is this functionality added?

Yes, using add_marked_bookmark and add_freetext_bookmark commands.

ahrm avatar Mar 28 '24 07:03 ahrm

Oh boy. I would like to warn people that when the next version of sioyek is released, it likely will be incompatible with the data saved in the development branch. Now it probably will be possible to move the data by slightly modifying and renaming the database files, but I just want people to know what they are getting into.

yes sir. don't worry , people installing this dev package are going to be most bet testers who want to try new features. one thing i would suggest will be to get this package renamed to sioyek-beta instead of sioyek-git.

Aneeqasif avatar Mar 28 '24 12:03 Aneeqasif