Dienstag, 20. Oktober 2009

PDF auf beliebigem Drucker ausdrucken - mit Acrobat



Das Plugin "pdf ausdrucken" druckt die pdf-Datei nur auf dem Standarddrucker aus, also dem Drucker, der dem Windowssystem als Standarddrucker bekannt gemacht wurde.
Oftmals möchte man aber an einem anderen Drucker im Netzwerk ausdrucken, ohne den Standarddrucker zu verändern.

Und so geht es:
Man verwendet das Plugin ".bat-Datei starten" zusammen mit einem kleinen Script. Hier die Anleitung von Adobe:

The DDE command line parameters for Acrobat and Reader are as follows. These are unsupported but have worked for some developers.

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.

Note: If using Acrobat, substitute Acrobat.exe in place of AcroRd32.exe in the command lines.
The current implementation of WatchDirectory's "Print PDF" plugin passes 2 parameters to Acrobat:
/p - like above: print the pdf
/h - undocumented - do not show Acrobat's window while printing

Und hier das Script, das watchDirectory verwenden kann:
rem wo ist Acrobat Reader installiert?
SET ACRO=C:\Programme\Acrobat\Reader\AcroRd32.exe
SET TIMEOUT=60
rem wenn der Servername/Druckername keine Leerzeichen enthält,
rem können die "" entfallen
SET PRINTER="\\servername\druckername"
SET GDPU=%WD_INSTDIR%\GdPUtil.exe

rem Dateityp überprüfen
IF "%WD_FILE_E%" NEQ "PDF" (
%ANNOTATE% Warn "Datei wurde nicht gedruckt, nur PDF-Dateien werden gedruckt"
GOTO :Eof
)

"%GDPU%" -runkill %TIMEOUT% "%ACRO%" /t "%WD_FILE%" %PRINTER%
%ANNOTATE% Info done

Bei diesem Script unbedingt den Speicherort der Acrobat-Startdatei und den Druckernamen anpassen!

Adobe® und Acrobat® sind eingetragene Warenzeichen von Adobe.

[Diesen Posting auf Englisch lesen / Read this post in English]