web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Return last page's tex...
Power Automate
Answered

Return last page's text result in an action of "extract text from pdf" with exceeding page parameter but I expect to get a return with error #unable to locate the page.

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I tried to extract text from PDF file with each page one by one.

I set new variable to increment specifying page in Loop condition but PAD keep returning the last page's result.

If you can advise about this specification and propose any workaround to realize, highly appreciated!

  • Verified answer
    MichaelAnnis Profile Picture
    5,727 Moderator on at

    Adobe Split Pro is an excellent solution if you work heavily with PDFs splitting, merging, etc.  it runs about $100 per computer license (one time payment).

     

    Without using that, is there any way to set your %LoopMax% to get this to stop? Check the PDF properties of the help menu.  Do PDFs have a %.Pages% property?  


    Do you know how many pages you are possibly expecting based on another source, say Excel?

     

    If neither of those work, try this;

     

    For each page in PDF

    Extract text from PDF %ExtractNew%

    If %ExtractNew% = %ExtractPrevious%

        Exit Loop

    #Else Do something with %ExtractNew%
    Set %ExtractPrevious% to %ExtractNew%
    End

     

    This will cause the loop to exit anytime the next page extracts the same exact text as the previous page. 

    Best of luck!

     

     

  • Yuto Profile Picture
    Microsoft Employee on at

    Hi Michael,

     

    Thank you so much for your kind answer.

    I believe Adobe Split Pro is one of functions on Adobe Pro as far as we searched.

     

    I have tried to locate the PDF pages by %.Page% in the valuable but it seems there is not option that we can NOT specify the page from the file.

     

    So I will try the loop as you kind noted, many thanks!

     

    Yuto

  • Yuto Profile Picture
    Microsoft Employee on at

    I could structure the flow below as you recommended, comparing the last and previous result of "extract text from PDF". I am a bit suprised a fact that there is no break function in IF/Else-if/Else statements...

    Yuto_0-1630484978951.png

     

  • Yuto Profile Picture
    Microsoft Employee on at

    I should have posted it in English sorry but I hope you can guess the desktop flow.

  • yoko2020 Profile Picture
    495 on at

    @Yuto 

    The break action name is Exit Loop

  • Yuto Profile Picture
    Microsoft Employee on at

    Hi @yoko

     

    Thank you for your reply.

    I tried the Exit Loop action but unfortunately it did not work under the If statement in the Loop. That's why I chose label/move(transfer?) pairs.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    I am not sure I understand.  If none of your IFs and ElseIFs are met, then it doesn't do anything.  So by default, it "breaks".  Else is the path to break if none of your previous IFs and ElseIFs are met.

     

    Your Else above does nothing...If you didn't have it, it would be exactly the same.  The IF statement would END anyway.

     

    Seems like you were able to get it to work.  Grats!

  • Yuto Profile Picture
    Microsoft Employee on at

    Hi Michael,

     

    Thank you for your comment. I meant the break under IFs under Loop like below did not work to get out of the root Loop somehow.

     

    --

    Loop

    IF statements

    break  Loop

    --

    In terms of Else in my desktopflow, Elseif can set condition only if there is Else, and Else cannot specify conditon in the action itself. That's why I set "vacant" Else after the Elseif.

     

    Anyway I could succeed to get out of the loop by your recommended comparison approach.

     

    Thank you.

     

    Yuto

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Sorry @Yuto , I misunderstood. The command is called “Exit Loop”.

     

    Maybe that’s why you weren’t able to find it. Good luck!

  • Yuto Profile Picture
    Microsoft Employee on at

    Hi @MichaelAnnis , I meant "Exist Loop" above by break Loop.

     

    Anyway, thank you for your kind support! The main streaming question has been solved, thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 307 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 127

Last 30 days Overall leaderboard