AngularJS - highlight text of existing pdf file in interface / browser

I found a library

PDF creation

Using this library, you can create different styles of pdf documents. My question will be if it is possible to tag the text (and possibly add a link to this tagged text) of an existing pdf file using AngularJS? Or is there a way around this?

+5
source share
1 answer

The question is too broad as it is - not sure what you mean by "mark" - do you mean the selection in some way or actually selected?

In any case, firstly, to go to the correct page - you can use the fragment identifiers in hyperlinks to link to a specific page in PDF format using the page parameter. eg.

 <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 using a hyperlink, you can use the highlight parameter, note that you must also specify the page to use the highlight parameter. eg.

 <a href="file.pdf#page=1&highlight=10,10,50,50">page 1 - highlight</a> 

The values ​​of the rectangle are integers in the coordinate system, where 0,0 represents the top left, and the values ​​are specified in the order lt, rt, top, btm.

You can also open the PDF file in the "Named destination", that is, the named section in the document using the nameddest parameter. eg.

 <a href="file.pdf#nameddest=mysection">my section</a> 

This is great because it doesn't matter if the pages are inserted, deleted, etc., since the section will always be correctly linked.

You can read Named Destinations here , as well as various Options for opening PDF files

0
source

Source: https://habr.com/ru/post/1272481/


All Articles