问题
I have found the library
PDF creation
With this library it is possible to create different styles of pdf documents. My question would be if there is a possibility to mark text (and maybe add a link to this marked text) of an existing pdf file with AngularJS? Or is there any workaround to do this?
回答1:
The question is a bit too broad as is - not sure what you mean by "mark" - do you mean highlighted in some way or actually selected?
Anyhow, firstly to get to the correct page -- you can use fragment identifiers in hyperlinks to link to a specific page in a PDF via the page
parameter. e.g.
<a href="file.pdf#page=1">page 1</a>
<a href="file.pdf#page=2">page 2</a>
If you want to highlight a specific section of a page, via a hyperlink, you can use the highlight
parameter, note you must also set the page to use the highlight parameter. e.g.
<a href="file.pdf#page=1&highlight=10,10,50,50">page 1 - highlight</a>
The rectangle values are integers in a coordinate system where 0,0 represents the top left, and the values are given in the order lt, rt, top, btm.
One can also open a PDF file to a "Named Destination", that is a named section in the document via the nameddest
parameter. e.g.
<a href="file.pdf#nameddest=mysection">my section</a>
This is great as it doesn't matter if pages are inserted, removed etc as the section will always be correctly linked.
You can read about Named Destinations here and also the various Parameters for Opening PDF Files
来源:https://stackoverflow.com/questions/46659210/angularjs-highlight-text-of-an-existing-pdf-file-in-frontend-browser