4

I am looking for a solution where in I am able to move to a specific line in a pdf embedded in HTML . At the moment I am using object tag to display the pdf in html page .

I know by using open parameters I can scroll through a pdf to a specific page but I am unsure how can this be achieved for a particular line navigation .

Open parameters example has been shared in the below mentioned question link but I need some parameter which helps me reach a particular line in PDF may be using some co-ordinates if that's achievable.The requirement is to scroll a PDF to a particular line and only the PDF should get scrolled not the original HTML page.

How to move the scroll bar of the browser on a pdf file with ASP / Javascript?

I can use any of the JQuery PDF viewers as mentioned here : http://www.jqueryrain.com/2012/09/best-jquery-pdf-viewer-plugin-examples/

in case your solution uses them .

Please note I don't want to move to a particular location in an HTML page as mentioned in below post rather its about navigating to a particular line in a PDF embedded in a page. How can I scroll to a specific location on the page using jquery?

Any help or leads would be really appreciated .

Thanks in advance.

Community
  • 1
  • 1
Rohit
  • 63
  • 1
  • 8
  • Have a look at https://github.com/mozilla/pdf.js/ Maybe this helps. – Philipp Braun Jun 26 '14 at 16:58
  • Thanks for your reply Philipp.But unfortunately even pdf.js doesn't seem to be solving my problem.In my original post I have mentioned a few pdf viewer plugins and pdf.js is the first among them but it seems I need control over pdf content to be able to achieve this functionality. – Rohit Jun 30 '14 at 07:04
  • What you could try is also read the whole file first. Then you can calculate the amount of lines over the font size. This will only work approximately, but is still a good option. Otherwise I think there is no option out there. Only way would be to adjust the pdf.js script. – Philipp Braun Jun 30 '14 at 10:57
  • 1
    Thanks ,have just got to know more about the requirement it is an image PDf that we need to scroll and not the traditional pdf .So, we have come to a point where very less or no control over the PDF is possible ,what we have asked in the meantime from the other team is to provide us with a pdf with named destinations if that's possible. In any case really appreciate your help ,will keep you informed about the solution ,in case you come across something better Please do let me know :) Cheers !!! – Rohit Jul 01 '14 at 06:31
  • Sharing solution so that in case somebody comes across the same problem in future ,they have some foundation to work upon.So, basically what we did was something very close to what Philipp had suggested earlier,we tried calculating the size of each page in pixels in photoshop and then calculated the line size .We put our iframe in which pdf was to be shown in adiv which had height equal to the no.of pages*into page size and then we tried scrolling the outer div using scrolltop function doing some simple mathematical calculations. – Rohit Oct 20 '14 at 10:15

2 Answers2

0

Create a destination in the PDF file (assuming you are the one generating it) at the appropriate line, and add #destination to the end of the URL

See https://helpx.adobe.com/acrobat/kb/link-html-pdf-page-acrobat.html#OpenaPDFfiletoasetdestination for an explanation on linking to PDF page numbers and destinations.

brichins
  • 3,825
  • 2
  • 39
  • 60
0

Assuming you don't have access to a PDF's source, you can open to a page by adding &page=pagenum to the URL as noted at link html pdf page. You may also want to look at this question.

Community
  • 1
  • 1
Nielsvh
  • 1,151
  • 1
  • 18
  • 31