I have a PDF document that I would like to split with each page being a separate file. I’d like to avoid installing anything to do this as I’m trying to keep the command simple for others to just copy/paste into PowerShell.

Would it also be possible to add the split command to the command below? It renames files based on the list of names found in names.txt. There is an equal number of files and names.

$names = cat "\path\to\names.txt"; $i=0; dir | % { ren $_ "$($names[$i]).pdf"}

  • pwshguy (mdowst)M
    link
    fedilink
    arrow-up
    1
    ·
    7 days ago

    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.