So I have a code like that
var text = await execPromise('pdftohtml -i -xml -stdout /tmp/test-sync');
const parser = new DOMParser();
let xmlDoc = parser.parseFromString(text);
let xmlTexts = xmlDoc.getElementsByTagName('text')
now pdftohtml gives a nice xml with position of each line and the content of it but how do I access it within the dom parser?
here's content from pdftohtml
pdf2xml producer="poppler" version="0.26.5">
<page number="1" position="absolute" top="0" left="0" height="1262" width="892">
<fontspec id="0" size="14" family="Times" color="#000000"/>
<text top="108" left="109" width="4" height="20" font="0"> </text>
<text top="142" left="109" width="77" height="20" font="0">Hi Mr Test, </text>
<text top="176" left="109" width="4" height="20" font="0"> </text>
<text top="210" left="109" width="659" height="20" font="0">This document has been created purely for testing purposes. Please find below all coding relevant </text>
<text top="232" left="109" width="680" height="20" font="0">for fields to be picked up by inCase, including signature feature, date, read confirmation and options. </text>
<text top="265" left="109" width="4" height="20" font="0"> </text>
<text top="299" left="109" width="95" height="20" font="0">Kind Regards, </text>
<text top="333" left="109" width="4" height="20" font="0"> </text>
<text top="366" left="109" width="100" height="20" font="0">Mr Fee earner </text>
<text top="400" left="109" width="4" height="20" font="0"> </text>
<text top="434" left="109" width="4" height="20" font="0"> </text>
<text top="466" left="109" width="4" height="20" font="0"> </text>
<text top="498" left="109" width="155" height="20" font="0">Signed………………………. </text>
<text top="518" left="109" width="158" height="20" font="0"> SIGN_ ARTHUR_ </text>
<text top="536" left="109" width="4" height="20" font="0"> </text>
<text top="568" left="109" width="151" height="20" font="0">Dated………………………. </text>
<text top="589" left="109" width="224" height="20" font="0"> DATE_ABOVE_HERE_JOE_ </text>
<text top="610" left="109" width="4" height="20" font="0"> </text>
<text top="641" left="109" width="155" height="20" font="0">Signed………………………. </text>
<text top="661" left="109" width="242" height="20" font="0"> SIGN_ABOVE_HERE_SUSAN_ </text>
<text top="680" left="109" width="4" height="20" font="0"> </text>
<text top="711" left="109" width="151" height="20" font="0">Dated………………………. </text>
<text top="733" left="109" width="245" height="20" font="0"> DATE_ABOVE_HERE_SUSAN_ </text>
<text top="755" left="109" width="4" height="20" font="0"> </text>
<text top="775" left="109" width="4" height="20" font="0"> </text>
<text top="809" left="109" width="157" height="20" font="0">READ_CONFIRMATION </text>
<text top="843" left="109" width="4" height="20" font="0"> </text>
<text top="876" left="109" width="4" height="20" font="0"> </text>
So I need to access each text and get its position and the actual text
So I have a code like that
now pdftohtml gives a nice xml with position of each line and the content of it but how do I access it within the dom parser?
here's content from pdftohtml
So I need to access each text and get its position and the actual text