Hi I have a pdf file i want to extract the line in the pdf file using uipath

Hi I have a single page pdf file i want to extract first line from that pdf file using uipath

Hija, Welcome!

Just need a bit more info: is this a native / digital pdf or a scan?

for native you can just use the Read PDF Text (pdf activities )
for scan / image you will have to use OCR

Once you have the text you can split it into lines with:
Dim rows As String() =text.Split(New String() {Environment.NewLine},StringSplitOptions.None)
Dim firstRow as String=rows.first

so use a Read PDF Text

use the output from that activity to split it into lines in a Invoke Code

can you please tell me what is the code you entered in edit code and what is Dim means and can we use Regex for this line extraction??

Dim rows As String() =input.Split(New String() {Environment.NewLine},StringSplitOptions.None)
Dim firstRow as String=rows.first

Dim is just the way to decare the variable in VB. If you are using C#
it would be String()rows=input.Split(New String() {Environment.NewLine},StringSplitOptions.None)
String firstRow =rows.first()

And regex you could try matching to \r\n|\r|\n for linebreaks.

in properties Read pdf you place a variable X = this is the text that is read from the pdf
For invoke code:
in input you add x so that you can work with the code
the output is the variable that you want to end up with: so the firstline

and you are right instead of String firstRow =rows.first() you right output =rows.first()
That was in my printscreen but i copied it wrong

aha you want line by line by line…

ReadPDF.xaml (5.6 KB)

I don’t know what regex you want… I would not use regex for this at all

Thanks my problem is resolved

NOw i have extracted data in a variable how can i pass the variable into email body using html code in uipath

Just assign

body="<div>Hello,<br>"+variable+"<br>Your friendly company robot.</div>"

Hello @Savitri1

You need to create a HTML template with the data embedded to it. Then in the email activity property, you need to enable “IsHTML”.

Then you will able to add the data in the HTML format.

No it is showing error. After extracted data is stored in a variable i used smtp activity to send email when i pass the variable as you said it is not working

What is the error?
Did you check the IsBodyHTML?
Does the variable have any characters that upset the HTML?

It is working

Great!
Can you close item by selecting thread as solution?

But When i am send mails if i have extracted 10 lines i am getting 10 emails one email for one line. Can we make total lines into one email

of course:

send the email after the for each line.
And make sure all the lines are in the variable that you use as body.
So in the for each line: assign variable=variable+“
”+line

still getting one email for each line

so you are send email in the for each line?

Can you send printscreen from flow?

I got my answer. Thanks