cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Failed to Extract Text with OCR with Tesseract Engine

I am currently trying to extract a small bit of text from a scanned pdf file.  I am using the "Extract Text with OCR" action and get the error below every time. I have tried either reading all of the text from the fall or a subregion with the same result. I have confirmed that the Tesseract connector is on my local machine.  I've also tried this with "Create Tesseract OCR engine" as the prior action (even though I believe that is no longer needed) with the same result. 

 

2021-06-16_16h34_34.png

 

Parameter is not valid.: Robin.Core.ActionException: Failed to extract text with OCR ---> System.ArgumentException: Parameter is not valid.
   at System.Drawing.Bitmap..ctor(String filename)
   at Robin.Modules.OCR.Utilities.Utilities.GetImageForOCR(OCRSource source, SourceScanMode sourceScanMode, Nullable`1 scanRegionX1, Nullable`1 scanRegionY1, Nullable`1 scanRegionX2, Nullable`1 scanRegionY2, IEnumerable`1 imagesToFind, Int32 tolerance, Boolean waitForImage, Boolean timeoutSet, Nullable`1 timeout, Nullable`1 searchRegionImageX1, Nullable`1 searchRegionImageY1, Nullable`1 searchRegionImageX2, Nullable`1 searchRegionImageY2, Action suspendSecureScreen, Action restoreSecureScreen, String imageFilepath, IImageFinder imageFinder)
   at Robin.Modules.OCR.Actions.ExtractTextWithOCRBase.Execute(ActionContext context)
   --- End of inner exception stack trace ---
   at Robin.Modules.OCR.Actions.ExtractTextWithOCRBase.Execute(ActionContext context)
   at Robin.Runtime.Engine.ActionRunner.RunAction(String action, Dictionary`2 inputArguments, Dictionary`2 outputArguments, IActionStatement statement)

I would greatly appreciate some help with this! 

30 REPLIES 30
Pavel_NaNoi
Impactful Individual
Impactful Individual

I'm just making sure here, but is the file a PDF or an actual image? I'm fairly certain that action cannot extract text from an actual PDF file, only images or a foreground window. If it is an image, this might honestly be a case of a weird image extension, make sure its in .jpeg or .png

I had played around with this and got it to partially work when I changed the file to a .png.  However, it still doesn't work when I use the selector tool to grab only a certain area of the image.  It only works if I grab all text from the image, and the results are very inaccurate. 

Most likely we will just need to incorporate a better OCR tool to get it to work as we need for our use case.

Thanks for the suggestion!!

Oh wait I forgot to ask, isn't there a PDF action in power automate desktop that extracts all the text instantly?

Pavel_NaNoi_0-1624453629178.png

You could probably just parse the text that you want from the variable that action produces. with regex

 

Also, yeah the OCR can be a bit of a pain when it comes to this, I recommend the free trial of AI builder on the power automate platform if you haven't accessed it yet, that thing works with pdfs and images and you can select exactly what you want to extract, fairly simple to understand as well, god that sounds like an advertisement when I read it out loud ^^| but yeah, give that a spin if you're out of options.

Well the problem is that this is a scanned document rather than a readable PDF so that's why I needed to use OCR. 

 

I started a free trial of AI Builder last week but didn't see how to use this with desktop Power Automate. I see that you could use Microsoft Computer Vision....but would love to play around with AI Builder in PAD if possible. Do you know how to make that work?

It depends if you have windows 10 pro/windows server 2016/windows server 2019 or not, if you do, it should be easy to feed ai-builder items into PAD through power automate, and I can help guide you through it a bit, otherwise it wont work.

 

Also, If you got it to run and its just being in-accurate, in the Tesseract OCRengine change the image width and height multiplier to 2 instead of 1,

Pavel_NaNoi_1-1624455113120.png

 

this should help it a lot, from there its more of finding the correct x and y positions of the text (use If Text on screen (OCR) to find the position of a specific text value more accurately)

 

 

 

Great -Thank you!

I have the same problem, but this problem is found after update from 2.13xx version to 2.14.173.21294, and my account is a free account, the OCR engine variable value show blank without any error message. Before update this engine can extract value. But now I have start a new flow and use the same pdf image use the same extraction method, but the unable to extract any text. What should I do ?

Its because the tesseract engine initialization action has been depreciated in that update,  the OCR engine initialization action didn't have much use outside of being an extra action, so its now just in any "Extract OCR Text" action where you have to select instead of "OCR engine variable" in OCR Engine type, to "Tesseract Engine" where it will work just like before. If that's not it you can also keep increasing the width and height like I mentioned in the previous post as that can also be the reason because OCR is just very janky.

 

Also, there's an action for extracting text from a pdf directly called "Extract text from PDF", try that if you get stuck and just parse it.

Unfortunately I was never able to get this to work consistently. Luckily the option to use an API call instead became available, and that works every time. 

Thank you for your reply, my cases can't use the Extract text from PDF, since the PDF is an invoice for user to sign and then scan back as an image.

 

In this case, base on my understanding from your advice, I should got another OCR Engine to install in windows and use the OCR engine variable to my flow, am I right ? ( btw, this version can select the tesseract engine in the pull down menu)

 

If the tesseract engine not working, where should I got those OCR engine ? (those require to paid and free engine)

Hi! 

Based on the recent update that was mentioned by @Pavel_NaNoi, PowerAutomate just took that extra engine action away. This does not mean you need to find another tool to use OCR, just use the in-built action "Extract text with OCR".  No "OCR Engine Variable" needs to go before the "Extract text with OCR". Hope this works for you!

Apologies, I've missed this in my notifications, what henry said is what i meant. ^^

Hi,

 

Thank you for your reply, but up to this moment same work flow and same PDF image with same extract X Y coordinate mark remain unable to capture anything after upgrade version from 2.13xxx to 2.14xxx. I have no idea what is going on. Except the version update no change.

 

That's why I post this problem to ask expert for. And I am not a programmer, I think I am a power user with a little bit technical knowledge. I have search for some expert suggestion in cloud API but most of them require monthly fee. From a free engine and working flow in 2.13xx to 2.14xx require to pay for a unexpected result cloud OCR API service, for me it is hard to ask for my boss to pay for this cost.

 

I still looking for any alternative solution and waiting for PAD may be next update to fix this OCR engine problem, if other user with the same unhappy experience. 

 

Can you give me a screenshot of what your flow looks like?

Hi Pavel,

 

Sorry for late reply,  here is the screenshot of my flow

 

henryhvb5_0-1636594336652.png

 

henryhvb5_1-1636594438069.png

 

henryhvb5_2-1636596836493.png

 

The major task for this flow is to capture the DEL number of the above image, and I have use the desktop record function and turn on the image recording and then right click the mouse to extract text from image. First highlight the DEL number and then anchor the "1 of 1" at the DEL number below and turn on the image matching algorithm to advanced. Before upgrade version, this algorithm is working fine in 2.13 xxx but extract nothing in version 2.14xxxx. Is there anything I do wrong in the anchor define or I need to change something to make this flow work again ?

 

Thank you for your help. 

Since I don't have the actual files, I had to improvise a little bit, I think your best bet might be doing something like this when you open the PDF up:

Pavel_NaNoi_0-1636652984299.png

This will basically take a screenshot of the PDF, save it as an image and then OCR it via image on disk type OCR, (width and height are both 1, if it fails to get the DEL number, increase them both a few times) I also did a regex with a lookbehind to ignore the DEL part, thought I'm not sure if that's needed, otherwise just do DEL\d+ which will keep the DEL part in.

 

Unfortunately the image file cannot be deleted via Delete File(s) action (no idea why) but there will only ever be 1 image file as it will get overwritten every time a new screenshot is taken, so just store it in a useless folder or delete it manually.

 

Hope this helps you out man.

Thank you for your help, Please try this image, this interface can't attach PDF file.

 

Thank you very much Pavel Test_DEL.png

Yep, it worked with this image, please try using the method I've shown in the screenshot of the previous post, put it after you've opened the pdf file and it should work.

 

Tell me if it doesn't and I'll see what else I can do.

Hi Pavel,

 

Unfortunately, I still unable to capture anything via the attached image, would you mind to share the inside parameter of the OCR capture part, I have try adjust the X, Y coordinate many time, except capture the whole image, but it is unstable to capture in differ image, sometime it can store the DEL number in line 30 of the variable, sometime in line 60 or sometime no record. That's why I would like to ask for the detail setting in your OCR text capture flow. I still try my best to use your method to locate the right parameter for capture DEL number.

 

Once again thank you for your help.      

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,503)