Been a while but here is the final code for anyone that is interested.
It requires three UDF's and it requires the PDF app Allen has linked to (command line version not the GUI).
The paths, the server and the printer are all based on my setup for testing this and should be set to your setup when using the script.
The PDF app splits documents into separate pages. In my case the source PDF had 128 pages. As far as I experimented with this the PDF app added zeros until the page number was four characters long. The exported file that has the customer data has just 1, 2 or 3 character for the page numbers so zeros get added until the page number from the file is four characters long. Maybe this can be changed to just the page numbers and no zeros but I’ll have to look into that. For now it works and is going to be used in a live environment this week.
The source CSV file has four columns separated by a comma. The first line has the column names. It has more data then is used in the code below but that data is used elsewhere in the script for the automatic creating and printing of a letter to go with the printed page.
Unfortunately Acrobat reader does not close by itself when printing is done so it gets killed by enunprocess 5 seconds after the print command is given. Acrobat reader is also slow so yes the sleep 5 is necessary or the file will not get printed because Acrobat reader is killed by the script before it can send the page to the printer.
All of this saves +/- € 3700 (+/- US$ 4400) on stamps in a year and several hours of work each week so people are happy (for now) 
Code:
Break on
;
Call @SCRIPTDIR + "\functions\Dirlist().udf"
Call @SCRIPTDIR + "\functions\EnuProcess().udf"
Call @SCRIPTDIR + "\functions\PrintTo2().udf"
;
$files = DIRLIST("d:\pdftest\onverwerkt\*.pdf",2)
$path = "d:\pdftest\tools\"
;
For Each $file in $files
$filepath = Split($file, "\")
$filename = SubStr($filepath[Ubound($filepath)], 1, Len($filepath[Ubound($filepath)]) -4)
Shell $path + 'pdftk ' + $file + ' burst output "d:\pdftest\split\' + $filename + '_%04d.pdf"'
;
$rc = Open (1, "d:\pdftest\export\test.csv", 2)
$line = ReadLine (1)
;
While @ERROR = 0
$line = Split($line, ",")
;$line[0] = Client number
;$line[1] = Company name
;$line[2] = Contact
;$line[3] = Adress
;$line[4] = Zip code
;$line[5] = City
;$line[6] = Page(s)
$line[0] = Trim($line[0])
$line[6] = Trim($line[6])
Select
Case Len($line[6]) = "1"
$line[6] = "000" + $line[6]
Case Len($line[6]) = "2"
$line[6] = "00" + $line[6]
Case Len($line[6]) = "3"
$line[6] = "0" + $line[6]
Case 1
$line[6] = $line[6]
EndSelect
If $line[0] <> "clientnumber"
PrintTo2("d:\pdftest\split\" + $filename + "_" + $line[6] + ".pdf","\\voyager\hp6840")
Sleep 5
$kill= EnumProcess("AcroRd32.exe",1)
EndIf
$line = ReadLine (1)
Loop
Next
_________________________
Mart
- Chuck Norris once sold ebay to ebay on ebay.