Question
TCS
IN
Last activity: 13 Feb 2019 8:15 EST
PDF Connector to read each line of PDF
Hi,
I want to read each line of PDF.
I am able to get the value by passing search string as input using PDF connector however my requirement is to read each line of PDF irrespective of any input string and accordingly need to put some extra logic.
***Edited by Moderator: Pallavi to update platform capability tags***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Infosys
IN
use PDFConnector text property.
TCS
IN
It is showing entire PDF text in single paragraph not line by line.
Is there any way we can get each line separately like we are getting line text if we search using string like Find Pages and Find Lines?
TCS
IN
Pegasystems Inc.
US
Hello Farhan,
To interact with a specific line you can use the PDFconnector 'Pages' property. You will then want to create a proxy for the Pages. This will give you a page array. Using this array you can iterate through each page.
Now while this allows you to iterate through each page it still doesn't get you where you need. What you'll want to do is use the 'get' method and create a proxy of the result. This will get you one specific page.
From there you can use the GetLine method and get a proxy of the result. This proxy allows you to work with a specific line.
By using this logic and a series of for loops you should be able to iterate through a PDF line by line.
TCS
IN
Thanks heffc for response.
I already using approach you have suggested however this only gives each lines of each page containing specific search string which we are passing as parameter.
My query is without passing search string, can we get each line of each page?
Pegasystems Inc.
US
Hey Farhan,
If you use the for loops the parameter you pass is just a count not a specific string to search for. If you're looking for a specific method that does this such a method does not exist.
TCS
IN
Are you saying to pass input strings as parameter in loop? I have below items in statements
01 Nov Transfer from FARHAN 750.00
Direct Debit - First Payment 315.81 302.90
ABCD
02 Nov Direct debit ABCD 27.14 1,275.76
I want to get lines having ABCD and then corresponding Date and Amount. If you see in first occurrence of "ABCD" date is not available in same line so we have to traverse back to get the date which is 1st Nov however 1st Nov row doesn't have ABCD mentioned in line
TCS
IN
Just to rephrase for better understanding, I have a requirement to read Date and Amount against each line containing specific word e.g. ABCD in below example.
01 Nov Transfer from FARHAN 750.00
Direct Debit - First Payment 315.81 302.90
ABCD
02 Nov Direct debit ABCD 27.14 1,275.76
I am able to get lines containing ABCD which is line 3 and Line 4. However if you see Line 3 doesn't have Date against ABCD which ideally is 01 Nov present in Line1.
However Line 1 doesn't have ABCD so I am not able to get Line 1 by searching ABCD as search input.
Hope this explains clearly. In case further information is needed, please message me.