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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / About PAD’s PDF Actions
Power Automate
Unanswered

About PAD’s PDF Actions

(0) ShareShare
ReportReport
Posted on by 49
Please tell me how to create the first, third, and last pages of a specified PDF as separate PDF files.
I know how to create pages 1 and 3 as separate PDF files, but naturally the number of pages in the PDF file to be processed changes each time, so I don't know how to get the last page.
Please tell me how to do it.
 
Categories:
I have the same question (0)
  • Suggested answer
    stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
     
    I suggest that use powershell or python script to get the total page number ( the last page).
    otherwise it's too slow to loop all the pages.
     
     

    Enjoy Power Platform and have a great day 🚀 |  My LinkedIn

    If the answer helps, please consider 👍, Thanks.

  • INOUE0202 Profile Picture
    49 on at
    Thank you for your answer.
    I know the words PowerShell and Python script,
    I have never used it.
    If you have a sample PowerShell or Python script, could you provide it?
    Or if you have any helpful links, please provide them.
     
  • Verified answer
    stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
     
    Maybe Python will be better for you.
    1. Download Python from Microsoft store ( in your windows PC),  the latest one is 3.13.
    2. After installation, open powershell, or terminal , then type 
      pip install pypdf
      3. Then save the code below as py type, for example getPdfPageNumber.py.
      from pypdf import PdfReader
      import sys
      
      # Pass the file path as an argument
      file_path = sys.argv[1]
      
      reader = PdfReader(file_path)
      print(len(reader.pages))  # This will be captured by PAD
      
      4, try it first in powershell or terminal. ( suppose that the script and the pdf in the same folder C:\temp\)
      Command:
      python "C:\temp\get_page_count.py" "C:\temp\myPdfFile.pdf"
      
       
    the detail, you have to figure out for example add more code within it or invoke it in PAD.
    Good luck.
     

    Enjoy Power Platform and have a great day 🚀 |  My LinkedIn

    If the answer helps, please consider 👍, Thanks.

  • INOUE0202 Profile Picture
    49 on at
     
    Thank you for your answer.
    I will try to approach it based on the answer I received.
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard