go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.76k stars 5.47k forks source link

gitea can not show pdf annotation #7139

Closed laoshaw closed 1 month ago

laoshaw commented 5 years ago

Running gitea 1.8.2 on Linux and just noticed the PDF with highlights are not shown highlights, just the original PDF, can gitea support pdf annotation like normal pdf readers(evince,etc)?

kolaente commented 5 years ago

IIRC Gitea does not render the pdf itself, it uses pdf.js or just lets the browser render the pdf. So this is more likely to be an issue with your Browser, not Gitea.

lafriks commented 5 years ago

@kolaente might be we need to update to library pdf.js to latest version

zeripath commented 5 years ago

Wow it looks like our pdfjs is quite old... v1.4.20

https://github.com/mozilla/pdf.js/releases/download/v2.0.943/pdfjs-2.0.943-dist.zip

is the most recent version

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

sapk commented 5 years ago

@laoshaw We updated the pdf viewer lib. Can you test on try.gitea.io if it works now ?

laoshaw commented 5 years ago

Just did a quick test unfortunately it basically still is not working, only a pop-up notes shown, all the highlight underline etc are no-shows.

laoshaw commented 5 years ago

https://pdf-highlighter.com/docs/Highlighting_PDF_Viewer.html this is based on pdf.js and it seems had things integrated well too

lunny commented 5 years ago

closed by #7834

laoshaw commented 5 years ago

why close this so quickly?

sapk commented 5 years ago

We shouldn't have close it if not fixed. I don't know a lot concerning pdf possibility but Highlighting PDF Viewer seems to need a serve side part.

Our viewer extension receives highlighting meta-data from the server and marks keywords in PDF viewer

Have you try to open your pdf with it ?

laoshaw commented 5 years ago

new pdf.js supposedly should be able to open annotation somehow it did not work under gitea yet. i have not used highlight-pdf-viewer myself. I will try to debug when I become more familiar with golang.

laoshaw commented 5 years ago

https://usefulangle.com/post/94/javascript-pdfjs-enable-annotation-layer How to Enable Annotations in PDF.JS

sapk commented 5 years ago

If you want to give it a try, pdfjs is now on the latest version and we load the viewer of pdfjs here : https://github.com/go-gitea/gitea/blob/bcbc9f33d73393c47b27793ac91b8f9faf98d349/templates/repo/view_file.tmpl#L66 The viewer is located here : https://github.com/go-gitea/gitea/tree/master/public/vendor/plugins/pdfjs

I don't think you will need to learn Go (just need to install it) to fix this as it is more a frontend problem. The command : TAGS=sqlite make clean generate build && ./gitea should be enough to start locally gitea with your changes.

Don't hesitate to open a PR to discuss over your code.

yp05327 commented 1 month ago

Any samples for test? Maybe this has been fixed.

wxiaoguang commented 1 month ago

There is no pdfjs anymore. PDF is rendered natively if it could be.

lunny commented 1 month ago

So I think it will depend on the web browser's support.