Read PDF From and To Location

Hello there,

There is a PDF that needs to be read and when the to location is incomplete example: Guntur becomes Gunt then exceptional handling needs to be logged, an email needs to come with attached pdf and send to user informing incorrect To Location.

Also when the there is from and to location and there are no flights or buses for it it should also handle exception handling.

Request your help here.

hi, @Rajat2 Welcome to Community!

Use Read PDF Text to extract locations, then validate the “To” location for completeness and check transport availability after that in a Try catch log exceptions and send an email with the original PDF attached to notify the user of any issues.

1 Like

@Rajat2 Is the location data is already provided if yes try to read the data from pdf using Read PDF text activity and extract the location name using regex or sny string manipulation after extraction check whether the name present in the list if yes the carry on the further process if no then use SMTP or outlook mail message activity to send mail and add same pdf as attachment and body mesage station location invalid.
Let me know if you need any more help

1 Like

@Rajat2

Welcome to the community

if you have the possible location names then can use them to check if the extracted text contains any of those values if present we are good else throw error

after checking flights or buses you can throw error based on response

cheers

1 Like

It is given but how can i create a list.

@Rajat2 Is the data provided in excel or any text file?

@Rajat2

if it in excel or so read the data into datatable and then after getting value can filter datatable with value extracted and if it has atleast one row then the value is present else no

cheers

1 Like

That data needs to be extracted from PDF and saved in variable but no where stored but we can store it need help

@Rajat2 Guntur becomes Gunt so i want to know is the name Guntur will be stored in any specific data file so that we can verify the extracted data

Yes, I have created an excel file with all the names of possible places for my demo

@vivek.nadar

Can you please show the steps how to use if condition and if it is true then continue forward else log message and send outlook mail message I have done.

All i need is the condition to put in IF and how to verify the To Location with the excel

@Rajat2 Ya i can provide the steps but can you let me know in PDF we will get “To location:Guntur” but is there any data souce containing list of locations so that we can compare it with the location we have extracted from pdf

Yes I have an excel file containing lists of to locations we can compare

@Rajat2 ok then first read the excel file and store it in data table “dt_data” then read the pdf file and extract the to location and store in a variable “Location”

Step 1:Use filter table activity for ColumnName=Location it will return the rows if the location available in the data table

Step 2:Condition 1 dt_data.rows.count>0 means (if the location name is right it will present in data table and our ow count will be greater then 0) in else block use smtp or sent outlook mail message activity to attach the pdf and send a mail Invalid location

Ste 3: In then block use another if condition to check whether there is flight or buses if not send a mail message or any other step you have to perform

Check to use Regex From and TO Location from extracted PDF string by using below -
From\s*:\s*(\w+)
To\s*:\s*(\w+)

Then add null check using if condition and then you can send email and attach same pdf as attachment