#165552 - 2006-08-07 07:22 PM
Re: Print one or more specific pages
|
Benny69
Moderator
   
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
it sounds like an advanced settings issue to the printer
|
|
Top
|
|
|
|
#165554 - 2006-08-07 08:16 PM
Re: Print one or more specific pages
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11628
Loc: CA
|
Actually I've been looking for the same / similar thing Mart.
I downloaded the SDK and it has some commandline stuff but so far have not found anything to allow me to select specific pages from the commanline.
Will update if I find a method, you do the same
|
|
Top
|
|
|
|
#165555 - 2006-08-07 08:16 PM
Re: Print one or more specific pages
|
Benny69
Moderator
   
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Some of my printers have separate advanced settings on the printers them selves, and if that is not it, it might be a driver issue, where are the drivers located, are they on the local machines or is this a TS or Citrix environment? I use Citrix and have had to go to a Bata driver and even that has not solved all the problems I am having. With one of my printers, I was using a jet direct to put it on the network but had to go to an internal network card to solve some communication problems, don’t ask me why that worked but it did.
|
|
Top
|
|
|
|
#165557 - 2006-08-07 09:01 PM
Re: Print one or more specific pages
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11628
Loc: CA
|
Yeah the money portion is not a big deal. For our needs though I suppose I could setup the machines with individual pages myself probably just as fast as using that tool.
From PlanetPDF Quote:
[From the DEVFAQ] AcroRd32.exe filename - Executes the Reader and displays a file.. AcroRd32.exe /p filename - Executes the Reader and prints a file.. AcroRd32.exe /t path printername drivername portname - Initiates Acrobat Reader,, prints a file while suppressing the Acrobat print dialog box,then terminates Reader. The four parameters of the /t option evaluate to path,printername,drivername,and portname (all strings). printername - The name of your printer.. drivername - Your printer driver 's name.Whatever appears in the Driver Used box when you view your printer 's properties. portname - The printer 's port.portname cannot contain any "/"characters;if it does, output is routed to the default port for that printer. If using Acrobat,substitute Acrobat.exe in place of AcroRd32.exe in the command lines.
These command lines are not supported, but seem to be quite stable.
|
|
Top
|
|
|
|
#165559 - 2006-08-07 09:18 PM
Re: Print one or more specific pages
|
Benny69
Moderator
   
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
idk man, i hate messing with printers, it seams that every piece of software (at least some of the older stuff i have to use) talks to the printers differently and can be a pain in the a$$. what brand/model of printer are you useing?
|
|
Top
|
|
|
|
#165562 - 2006-08-07 10:20 PM
Re: Print one or more specific pages
|
Benny69
Moderator
   
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
let us know how it turns out dude, maybe someone else can benefit from it to, you da man.
|
|
Top
|
|
|
|
#165563 - 2006-08-07 10:56 PM
Re: Print one or more specific pages
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Don't know if this will help, but its free...
AccessPDF - PDFtk
{Edit: and here is a GUI for this too... http://www.paehl.de/pdf/?GUI_for_PDFTK }
Edited by Allen (2006-08-07 11:00 PM)
|
|
Top
|
|
|
|
#165565 - 2006-08-08 12:48 PM
Re: Print one or more specific pages
|
Mart
KiX Supporter
   
Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
|
Allen's app above works like a charm but has some limitations that make it unusable for us in this project. For example you cannot specify a target folder to extract the file to when using burst mode. Maybe I'm blind but can't find a way in the docs to get it working the way we require.
The script below works great. You need to purchase the pdf splitting app when you do not want the watermark at the bottom of each page but that’s only 28,00 US$. Sadly it is necessary to kill acrobat reader when it is done printing cause it does not exit by itself. Word or notepad do not need to be killed. In our case the $page variable will eventually be filled by reading from a file that gets exported from our database once a week. For testing it is set to a specific value. Our test.pdf file has 128 pages so the extracted pages have 001, 002, etc… in the filenamens therefore $page should be set to 075 to get page 75, 009 to get page 9, etc…. A check on the amount of extracted pages will show you if and how many leading 0’s should be added.
Code:
Break on
Call @SCRIPTDIR + "\functions\DirList().udf" Call @SCRIPTDIR + "\functions\EnumProcess().udf" Call @SCRIPTDIR + "\functions\printTo2().udf"
;Del "c:\pdftest\split\*.pdf"
$path = "C:\pdftest\tools\" $files = DIRLIST("c:\pdftest\onverwerkt\*.pdf",2) $page = "075"
For Each $file in $files $filepath = Split($file, "\") $filename = SubStr($filepath[Ubound($filepath)], 1, Len($filepath[Ubound($filepath)]) -4) Shell $path + "pdfspme_cmd.exe -spe " + $file + " c:\pdftest\split\" + $filename PrintTo2("c:\pdftest\docs\defaultletter.doc","\\server\printer") PrintTo2("c:\pdftest\split\" + $filename + $page + ".pdf","\\server\printer") Sleep 5 $kill= EnumProcess("AcroRd32.exe",1) If @ERROR = 0 Del "c:\pdftest\split\*.pdf" Else ?@ERROR ?@SERROR Sleep 5 Exit EndIf Next
_________________________
Mart
- Chuck Norris once sold ebay to ebay on ebay.
|
|
Top
|
|
|
|
#165566 - 2006-08-08 04:01 PM
Re: Print one or more specific pages
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Hey Mart... try this
Code:
pdftk "Your.pdf" burst output "c:\outdir\pg_%04d.pdf"
|
|
Top
|
|
|
|
#165568 - 2006-08-13 09:42 PM
Re: Print one or more specific pages
|
Mart
KiX Supporter
   
Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
|
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.
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 657 anonymous users online.
|
|
|