jlegewie / zotfile

Zotero plugin to manage your attachments: automatically rename, move, and attach PDFs (or other files) to Zotero items, sync PDFs from your Zotero library to your (mobile) PDF reader (e.g. an iPad, Android tablet, etc.), and extract PDF annotations.
4.03k stars 280 forks source link

pdf x-change editor #239

Open eiselesr opened 8 years ago

eiselesr commented 8 years ago

When extracting annotation from pdfs in pdf x-change editor the text from highlights, sticky notes and pop-up notes are captured but if Text box annotations are used these are not picked up by zotfile.

I believe it is possible to capture them since docear is able to, but I am not sure how to go about capturing them. Do you have any suggestions for adding that functionality?

jlegewie commented 8 years ago

Yes, that should be possible but I never looked into it. I also won't do it. You can take a look though but it does require some knowledge. chrome/content/zotfile/pdfextract/pdfjs/src/getPDFAnnotations.js filters out the supported annotations (see variable SUPPORTED_ANNOTS, which is set to ["Text", "Highlight", "Underline"]). But it's going to be more work than just changing that variable.

eiselesr commented 8 years ago

Thanks for your quick response. Could you point me at what else might need changing? js is pretty new to me.

I appreciate any guidance you can provide.

-Scott Eisele

On Wed, Aug 3, 2016 at 8:04 AM, Joscha Legewie notifications@github.com wrote:

Yes, that should be possible but I never looked into it. I also won't do it. You can take a look though but it does require some knowledge. chrome/content/zotfile/pdfextract/pdfjs/src/getPDFAnnotations.js filters out the supported annotations (see variable SUPPORTED_ANNOTS, which is set to ["Text", "Highlight", "Underline"]). But it's going to be more work than just changing that variable.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jlegewie/zotfile/issues/239#issuecomment-237229836, or mute the thread https://github.com/notifications/unsubscribe-auth/AI1JtHCy0K0gwCn6vXH1zoxT_ZvbvJuHks5qcJHXgaJpZM4JbM81 .

eiselesr commented 8 years ago

I believe I'd have to add to the annotation.js script for freetext annotations.

// TODO(mack): Implement FreeText annotations if (subtype === 'Link') { return LinkAnnotation; } else if (subtype === 'Text') { return TextAnnotation; } else if (subtype === 'Widget') { if (!fieldType) { return; }

Is there anything else? Or would this be a better question for the pdfjs guys?

On Wed, Aug 3, 2016 at 6:28 PM, Scott Eisele eiselesr@gmail.com wrote:

Thanks for your quick response. Could you point me at what else might need changing? js is pretty new to me.

I appreciate any guidance you can provide.

-Scott Eisele

On Wed, Aug 3, 2016 at 8:04 AM, Joscha Legewie notifications@github.com wrote:

Yes, that should be possible but I never looked into it. I also won't do it. You can take a look though but it does require some knowledge. chrome/content/zotfile/pdfextract/pdfjs/src/getPDFAnnotations.js filters out the supported annotations (see variable SUPPORTED_ANNOTS, which is set to ["Text", "Highlight", "Underline"]). But it's going to be more work than just changing that variable.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jlegewie/zotfile/issues/239#issuecomment-237229836, or mute the thread https://github.com/notifications/unsubscribe-auth/AI1JtHCy0K0gwCn6vXH1zoxT_ZvbvJuHks5qcJHXgaJpZM4JbM81 .

jlegewie commented 8 years ago

With that change, you are actually changing pdf.js core. Not necessarily a good idea. Zotfile does that but it should be reduced to a minimum. You should try get the annotations (that is what page.getAnnotations() in getPDFAnnotations.js does, find an object with the annotation type you are interested in and see whether it already contains the text you need. You can either figure that out by actually looking at the javascript object or by looking at the pdf.js documentation (or if that doesn't exist code).