I have a large PDF file containing employee information. One page per employee, 500+ pages. I need to create a single PDF file per employee by splitting out this large file into smaller ones. I researched similiar questions regarding that subject here and found a answer that may help but I have run into a glitch of sorts.
While the code executes without errors and says it is processing the files, even giving the file name, it outputs nothing at all. by output I mean no files are created
I am using PDFtk to accomplish this on Powershell. Hopefully someone can point out why I am not getting any output.
this is my code
$pdfPath = 'C:\pdffiles\'
$pdfFile = Join-Path $pdfPath "empdf.pdf"
$OutDir = "C:\TestOutput\"
$SetsOfPages = 2
$NumberOfPages = 546
for ($Page=1;$Page -le $NumberOfPages;$Page+=$SetsOfPages){
$File = Get-Item $pdfFile
$Range = "{0}-{1}" -f $page,[math]::min($Page+$SetsOfPages-1,$NumberOfPages)
$OutFile = Join-Path $OutDir ($File.BaseName+"_$Range.pdf")
"processing: {0}" -f $OutFile
pdftk $pdfFile cat $Range Burst output $OutFile
}
I have ensured that the pdftk executable file is in the proper location. The code runs without any displayed errors.