Shared PDF Printer for windows clients

If you want to create a PDF printer on windows machine and share it for all you user, follow this short guide.

The PDF are generated on a folder called C:\PDFOUT (you can modify this folder on script) on printserver machine so you need also to share this folder and inform your users that after sended the print they need to connect to shared folder for find the PDF.

Download GHOSTSCRIPT for windows and install it: Ghostscript
The scripts are configured to search gs on C:\Program Files\gs

From same site download and install REDMON
I  installed it on C:\Program Files\gs\redmon17

Download UNIXUTIL ans unzip it: unixutil
The script are configured to search unixutil on c:\Program Files\gs\unixutils

Create a file called PDFWRITE.TXT an save it on C:\Program Files\gs

-I"C:\Program Files\gs\gs8.64\lib";"C:\Program Files\gs\fonts"

 -sDEVICE=pdfwrite
 -r600
 -dNOPAUSE
 -dSAFER
 -sPAPERSIZE=A4

Create a file called PDFPRINT.BAT and save it on C:\Program Files\gs

@echo off
::
:: Generate a unique filename
::
"C:\Program Files\gs\unixutils\echo" -n "set PDFNAME=C:\PDF\tmp\" > c:\PDF\tmp\tmp.bat
echo.|time | "C:\Program Files\gs\unixutils\md5sum" | "C:\Program Files\gs\unixutils\gawk" "{print $1}" >> C:\PDF\tmp\tmp.bat
call C:\PDF\tmp\tmp.bat
::
:: Make the PDF
::
"C:\Program Files\gs\gs8.64\bin\gswin32c.exe" -sOutputFile=%PDFNAME% %1 %2 %3 %4 %5 %6 %7 %8 %9
::
:: Find correct Filename
::
"C:\Program Files\gs\unixutils\echo" -n "set NEWPDF=%REDMON_USER%-" > C:\PDF\tmp\tmp.bat
"C:\Program Files\gs\unixutils\echo" -n "PDF-" >> C:\PDF\tmp\tmp.bat
"C:\Program Files\gs\unixutils\echo" -n "%REDMON_JOB%-(" >> C:\PDF\tmp\tmp.bat
"C:\Program Files\gs\unixutils\echo" -n %REDMON_DOCNAME% | "C:\Program Files\gs\unixutils\sed" "s/[^a-zA-Z0-9 ]//g" | "C:\Program Files\gs\unixutils\sed" "s/^ *(...............).*/1/" | "C:\Program Files\gs\unixutils\sed" "s/ *$//" | "C:\Program Files\gs\unixutils\sed" "s/ +/_/g" >> C:\PDF\tmp\tmp.bat
"C:\Program Files\gs\unixutils\echo" ").pdf" >> C:\PDF\tmp\tmp.bat
call C:\PDF\tmp\tmp.bat
::
:: rename (doh!)
::
ren %PDFNAME% %NEWPDF%
::
:: move to final destination
::
move C:\PDF\tmp\%NEWPDF% C:\PDFout
::
:: make clean
::
del C:\PDF\tmp\tmp.bat

Create a Printer Port type: “Redirected Port” and configure it as showed on image.

Create and share a printer linked to this new port with a ps driver; I use “Ghostscript PDF” driver found on ghostscript folder C:\Program Files\gs\gs8.64\lib

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s