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 / How can we get count n...
Power Automate
Answered

How can we get count number of pages in pdf using Power automate desktop?

(1) ShareShare
ReportReport
Posted on by 8
how can we count the number of pages in pdf using Power automate desktop
  • Verified answer
    VishnuReddy1997 Profile Picture
    2,666 Super User 2026 Season 1 on at
    Hey Hi,
     
    Power Automate Desktop doesn't offer a direct action to count PDF pages. However, we can achieve this by using Two methods.

    1. By using Extract Tables from PDF as shown below.


    Code:
    Pdf.ExtractTablesFromPDF.ExtractTables PDFFile: $'''C:\\Users\\Desktop\\Power Automate Desktop\\Projects\\Digital Signatures\\Input Files\\9102401396.pdf''' MultiPageTables: True SetFirstRowAsHeader: True ExtractedPDFTables=> ExtractedPDFTables
    Display.ShowMessageDialog.ShowMessage Title: $'''Pages Count''' Message: ExtractedPDFTables.Count + 1 Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    

    2.Python Script.
    ​​​​​​​
    Run the below Python Script using Run PowerShell script action as shown in below image.
     
     
    Python Code:
    import fitz  # PyMuPDF
    import sys
    
    def count_pages(pdf_path):
        pdf_document = fitz.open(pdf_path)
        num_pages = pdf_document.page_count
        return num_pages
    
    if __name__ == "__main__":
        if len(sys.argv) != 2:
            print("Usage: python count_pages_pymupdf.py <pdf_path>")
            sys.exit(1)
    
        pdf_path = sys.argv[1]
        num_pages = count_pages(pdf_path)
        print(f"{num_pages}")
    
     

    (Note:- if you got your solution you can mark as solution and gives kudos)

    Thanks & Regards
    Vishnu Reddy

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 249 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 198

#3
David_MA Profile Picture

David_MA 197 Super User 2026 Season 2

Last 30 days Overall leaderboard