Pdf.js: Option to disable showing of PDF annotations

Created on 3 May 2016  路  19Comments  路  Source: mozilla/pdf.js

is there an option for PDF.js not to show annotations embedded in the pdf?

1-viewer 2-feature

Most helpful comment

I think I'm fine with this if it can be made a preference (disableAnnotationLayer) like https://github.com/mozilla/pdf.js/blob/master/web/default_preferences.json#L12.

All 19 comments

There is no such option. However depending on type of annotation some of them placed into operator list, some of them in the separate request.

If you need a workaround, disable getting of annotations at https://github.com/mozilla/pdf.js/blob/master/src/core/document.js#L320

thanks yury. hope there'll be an option in the next update. this would come in handy.

this would come in handy.

please explain why -- this will help to prioritize the issue.

ive created an annotation layer on top of every pdf.js page amd i figure that while ive extracted the annotations in the pdf, saves to darabase and shown them in my annotation layer, by not showing them in the pdf.js layer, the resource consumption may lessen

at least that is what i think

please explain why -- this will help to prioritize the issue.

The project I'm working on retrieves annotations separately so that they can be edited on top of the page and saved through a web service. For this reason, we don't want PDF.js to render the annotations because we will be showing them on our own.

just wish to follow up, will this be considered?

please advise.

I think I'm fine with this if it can be made a preference (disableAnnotationLayer) like https://github.com/mozilla/pdf.js/blob/master/web/default_preferences.json#L12.

Is there any update regarding the above issue ?? I also want to disable rendering of annotations by default. Please advice something.

Also interested in disabling the annotations. Could be in preferences or maybe as a page render param

I would also be interested in an option to disable the annotation layer. the one specifically that i would like to not render would be hyperlinks. because for security reasons we do not what the user to be able to click on the links.
currently i am just setting the annotationLayer class to display: none.

Possibly a special case, but we had a complaint on SuMo that it is distracting to have an annotation appear on hover for a highlight annotation when highlighting has been used liberally in a document. https://support.mozilla.org/questions/1246527

Maybe show popup only if there is any "Contents" or "RichText" ? That's what Acrobat does.

please explain why -- this will help to prioritize the issue.

The project I'm working on retrieves annotations separately so that they can be edited on top of the page and saved through a web service. For this reason, we don't want PDF.js to render the annotations because we will be showing them on our own.

Hello,
could you please tell me how this is done by putting the annotations on another layer, did you use any other tools? or some additional library option.

Thank you

@harryMamani you mean like this?

https://youtu.be/g2YAn-Yvlss

I'm assuming the disableAnnotationLayer option is not available yet or this issue would be closed.

I'm looking to implement my own annotation layer, but some annotations are rendered directly in the canvas (e.g. highlighting). Is there any place on the API surface of the display layer of PDF.js that I can use to prevent this behavior? Are there any workarounds at all?

@chitgoks

youtu.be/g2YAn-Yvlss

How'd you get annotations not to show?

@chitgoks

youtu.be/g2YAn-Yvlss

How'd you get annotations not to show?

you can listen to the event when the page was created and remove or hide the annotation layer.

you can listen to the event when the page was created and remove or hide the annotation layer.

I can simply not call AnnotationLayer.render(options) which means a small subset of annotations are not separately rendered inside a div, but the other annotations (e.g. ink, polyline, square, etc) are painted directly onto the canvas element. Your video makes it looks like these other annotations are also not rendered by PDF.js, but separately rendered by you. I also want to separately render them.

Am I misunderstanding you that you successfully got all annotations to stop being rendered by PDF.js?

ahh.ok i forgot about that behavior. that video happened when there was no annotationLayer yet.

yep, its a separate canvas.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

smit-modi picture smit-modi  路  3Comments

THausherr picture THausherr  路  3Comments

timvandermeij picture timvandermeij  路  4Comments

AlexP3 picture AlexP3  路  3Comments

zerr0s picture zerr0s  路  3Comments