Einzelnen Beitrag anzeigen

hathor
(Gast)

n/a Beiträge
 
#25

Re: PDF an beliebigen Drucker schicken

  Alt 31. Okt 2009, 16:19
Den gewünschten Drucker vorübergehend zum Standarddrucker zu machen sollte doch möglich sein.

Und dann...

Delphi-Quellcode:
uses ShellAPI;

procedure PrintPDF(Filename: WideString);
begin
  ShellExecuteW(0, 'open', 'acrord32', PWideChar('/p /h ' + Filename), nil, SW_HIDE);
end;

procedure TForm1.PrintPDF1Click(Sender: TObject);
begin
PrintPDF('test.pdf');
end;
You can display and print a PDF file using command lines with Acrobat and Acrobat Reader.
AcroRd32.exe filename - Executes the Reader and displays a file.
Other options for the command line are:
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.
option meaning:
/n Launch a separate instance of the Acrobat application, even if one is currently open.
/s Open Acrobat, suppressing the splash screen.
/o Open Acrobat, suppressing the open file dialog.
/h Open Acrobat in hidden mode.
  Mit Zitat antworten Zitat