Search This Blog

Wednesday, 23 July 2008

Print PDF to any printer - Without Acrobat

The previous post showed how you can print to any printer with some "secret switches" passed to Acrobat Reader®. Here is another way to print PDFs without using Acrobat at all. This is a far more efficient way of printing as it doesn't need to load Acrobat.

For this to work, your printer must support direct printing of PDF/Postscript (nearly all Postscript Level 3 printers support this).

Create a file called AutoPrintPdf.bat using a plain text editor (notepad, do not use editors like MS Word!), and enter the following inside the file:

rem ignore files that do not have a PDF extension
rem ignore all events, except FILENEW (a new file is created)
rem send it to printerport "raw" on server "server"
LPR -S server -P raw "%WD_FILE%"

Replace server with the name or ip address of the server to which the printer is connected.
Replace raw with the name of the printer. If this name contains spaces, surround the name with "quotes".

Create a new watchDirectory task, select the Run an existing .bat file plugin.
Click the "EXBAT" variable, and browse/select the AutoPrintPdf.bat you have just created.
On the Filter Events page create a filter so this task will only process files with a PDF extension.
On the Events page, only select the FILENEW option.

Or just use Foxit Reader

The current WatchDirectory release has a new task that uses Foxit Reader to print PDF's. Please see this blogpost.

Monday, 21 July 2008

Print PDF to any printer

The current implementation of WatchDirectory's Print PDF plugin always prints to the default printer. Here is a small tip if you want to print to another printer.

This is what Adobe has to say on this subject:

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

If you want to print to another printer than the default, you need to use the "Run Any Bat File" plugin (you will find it on "New Task -> Scripting") and use the following batch file to do the printing:

rem you may need to change this, where is acrobat reader?
SET ACRO=C:\Program Files\Acrobat\Reader\AcroRd32.exe
rem if the printername doesn't contain spaces, remove the "quotes"!
SET PRINTER="My Printer"

rem check for valid file type
   %ANNOTATE% Warn "File not printed, only PDF files are supported"
   GOTO :Eof

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

Please change the script as needed (printername, location of Acrobat Reader).

Adobe® and Acrobat® are registered trademarks of Adobe.

Tuesday, 1 July 2008

WatchFTP Roadmap

This post will show you some future enhancements that are planned for WatchFTP.

version 1.1 (end of summer - probably beginning of August)
* Add support for a history database instead of plain log files

version 2.0 (no estimate yet) - this will be a free upgrade for version 1.x customers
* Tighter integration with our other program WatchDirectory - WatchFTP will be able to "alert" WatchDirectory directly about newly downloaded files. In this case WatchDirectory will not need to monitor a directory for changes.

A lot of other (smaller) features are planned, but the above are the major ones. All suggestions are welcome.