简体   繁体   English

在用户点击的位置上注释pdf文件

[英]Annotate the pdf file on the location clicked by user

I am having trouble in trying to find the solution for the below described problem. 我在尝试找到以下问题的解决方案时遇到了麻烦。

Annotate the PDF file when user clicks on specific location in pdf and then finaly save the pdf which in future opens at annotated location. 当用户单击pdf中的特定位置时,对PDF文件进行注释,然后最终保存pdf,以后会在带注释的位置打开该pdf。

How to approach this? 如何处理呢?

What I have tried. 我尝试过的。

  • I have tried to find various libraries irrespective of programming language (since programing language is not the dependency)- found few libraries like minipdf in python , pdfbox in java to mention few relevant ones. 我试图找到各种与程序语言无关的库(因为程序语言不是依赖项)-在python找到了诸如minipdf库,在java找到了pdfbox ,仅提及了一些相关的库。 Finally selected pdfbox since it seemed to be mature enough to provide the solution closeby. 最终选择了pdfbox因为它似乎已经足够成熟,可以提供附近的解决方案。
  • There are various hurdles now how to get user the location clicked by the user? 现在有各种障碍如何使用户获得用户单击的位置? since after getting the location I can able to perform various actions like annotating at the clicked location and then saving the pdf on the same specific location. 因为获取位置后,我可以执行各种操作,例如在单击的位置进行注释,然后将pdf保存在相同的特定位置。
  • It seems I have to write whole pdf javascript to approach it but again how to do so? 看来我必须编写整个pdf javascript才能使用它,但是又该怎么做?

I had similar problem and have solved it the other way. 我有类似的问题,但已经用其他方法解决了。 In my case I am not opening PDF in Adobe reader, but in browser. 就我而言,我不是在Adobe Reader中打开PDF,而是在浏览器中打开。 So what I did is converted the pdf to html using python libraries (Let me know if you are interested, I will share different library names with their pros and cons). 因此,我所做的就是使用python库将pdf转换为html(如果您有兴趣,请告诉我,我将与他们的优缺点共享不同的库名称)。
Now that html can be edited easily. 现在,可以轻松地编辑html。 We can put hyperlinks, highlights everything there as source code is with us. 我们可以放置超链接,突出显示其中的所有内容,因为源代码与我们同在。
This workaround may be applicable to you if your front end is web based. 如果您的前端是基于Web的,则此变通办法可能适用于您。


PS: Wanted to post this workaround as comment, but couldn't due to little less reputation count as of now. PS:希望将此变通办法发布为评论,但由于目前信誉数很少而无法发布。 Hope, it won't be downmarked :) 希望,它不会被降级:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM