Skip to main content
September 8, 2016
Question

How to find the first line of the each page in pdf? is this possible to find the new line using javascript(/n or /r)

  • September 8, 2016
  • 1 reply
  • 339 views

Hi,

I want to find the text of first line in each page.  Is there any way to find this using javascript?

is this possible to regex '/n' charater to find the new line in pdf?

Ariv

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

try67
Community Expert
Community Expert
September 8, 2016

You can retrieve the text in a PDF using JavaScript, but determining what is the first line is not so trivial.

First of all you'll need to define what is the "first line" of a page. Does it include header? Titles? What if the page has multiple columns? etc. On top of that the order in which the script returns the words in the page does not necessarily correspond to their physical order, so you would need to sort them first. And on top of that, each word is returned on its own, and there may or may not be line-breaks in them, so you would need to analyze their locations and determine which ones are on the same line...