PowerShell does not have a built in PDF reader, so it is not possible without installing a module or calling a third party app. The PSWritePDF module will do what you are asking. The module can be installed from the gallery, so you could technically install and import it in a single line.
Powershell
PowerShell (POSH) is a a task automation command-line shell and scripting language created by Microsoft. It became part of the FOSS community in 2016 and is now available across Windows, Linux, and macOS
Resources:
- Install PowerShell – Instructions for Windows, Linux, and macOS
- PowerShell Galley Your one-stop shop community and Microsoft modules.
- PowerShell Repository – View the PowerShell source code, report issues, or contribute to the project yourself.
- PowerShell Community Call – Hear from and talk directly to the product team on the 3rd Thursday of every month
- PowerShell in Visual Studio Code – It’s time to say goodbye to ISE
Rules:
- Be civil (aka don’t be a jerk). Remember there are people from all walks of life, all with different levels of expertise. You can disagree with someone, but please be civil when doing so.
- Adhere to the Lemmy Code of Conduct
- Follow all programming.dev rules
- Posts must relate to PowerShell or the PowerShell ecosystem.
- Use code blocks to make things easier to read.
- Memes and humorous posts are allowed but try not over do it. And keep them relevant to PowerShell
- No discussion about piracy or hacking.
- If someone provides an answer that solves your problem, please reply, so others know what the solution was. ^And^ ^so^ ^the^ ^person^ ^who^ ^suggested^ ^it^ ^gets^ ^that^ ^oh^ ^so^ ^sweet^ ^shot^ ^of^ ^dopamine.^
- If you find a solution to your problem by other means, please take your time to write down the steps you used to solve your problem in the original post. You can potentially help others having the same problem!
Self-promotion rules:
- Self-promotion content must be marked as [OC]
- Do not SPAM. Content must be PowerShell related.
- Only 10% of your contributions can be self-promotion. In other words, 90% of your contribution must not be self-promotion.
- Personal blogs are not considered self-promotion, at this time, as long as they are free to access and relevant. Please do not abuse this.
You can manage an install-less solution with a docker container assuming you can get docker on the client machines.
There are numerous PDF cli tools that will split pages for you, so the challenge is finding the right one that is trivial for you to use with docker.
My internet sleuthing revealed that there is already a ready-made docker image for an older version of Apache PDFbox, but there are likely other docker containers you could use.
You can incorporate usage into the above snippet pretty easily if you ask one of the AI chatbots. Your prompt will be something like: "Given this one-liner in Powershell (copypaste the one-liner), I want you to change it to also use this docker container (link to github) of Apache PDFBox 2.0 (link to PDFBox docs) to split PDFs into pages. Rewrite the one-liner to do this."
I can't help you, but there's an issue with your formatting so the code won't show. You need the apostrophes on the same line, for the "format as code" things to work.
$names = cat "\path\to\names.txt"; $i=0; dir | % { ren $_ "$($names[$i]).pdf"}
Updated. Thanks!
Windows should have a built in Print to PDF option under printers you can use in conjunction with the print menu to "print" individual pages to PDF.
Based on https://en.wikipedia.org/wiki/PDF#Technical_details I'm going to guess that's not going to happen unless powershell has some built-in thing for manipulating PDFs. I'd start searching there.