Do you send emails with attached Word or Excel files which:
  1. can carry viruses,
  2. may not display the same on someone elses computer (if they can open the file at all!),
  3. can be modified by the recipient without your knowledge,
  4. are much larger than needed just to get your message through?
You should be using Portable Document Files (PDF) which can be read on any platform with the free Adobe Acrobat Reader .

The only problem is that Adobe want big bucks for the tools to create the files. Fortunately there is a free alternative - if you configure a Windows Postscript printer driver to create a Postscript file, you can print anything to the file and then use AFPL Ghostscript to convert the Postscript file to PDF. The only problem with this is that is Ghostscript uses a command line interface and lots of complicated parameters so it is not at all easy to use. So I created a simple but powerful Front End......

MakePDF

Screen Shot

FEATURES

You can use MakePDF in a number of ways:
  1. Put a shortcut to MakePDF in "C:\WINDOWS\SENDTO" and then right click on a postscript file and use the Send To Menu.
  2. Place a shortcut to MakePDF on the desktop and drag and drop files onto it.
  3. Specify MakePDF as the default "Open" program for a particular file extension, name your postscript files appropriately and then double click on any postscript file.
  4. Call MakePDF from the commandline or from a batch file with switches to select various options.
  5. Call MakePDF from a macro or procedure in another application to create a PDF and send it to a MAPI complaint email program with one click
There are a number of options which can be selected when you run MakePDF either by selecting them on the screen or by using command line switches when starting makePDF.
  1. Specify the Version of PDF file to create (If you specifying this on the commandline together with the input filename, and optionally the output filename, MakePDF will create the PDF file and then close with no user interaction - useful for batch files and calling from other applications)
  2. View the PDF file in Acrobat once it is created
  3. Delete the intermediate Postscript file or leave it in place
  4. Display or ignore error messages
  5. Perform "batch" conversions of multiple postscript files using wildcards
  6. Send the resulting PDF file to your MAPI compliant email program
You can further automate your PDF handling by using one of MakePDF's two companion programs MailPDF or FTP-PDF
. With MailPDF, you can create and send PDF files through your MAPI complaint email program with no user intervention.
MailPDF lets you specify addresses, subject heading, body text and the file to convert and attach to the message from the command line.
. With FTP-PDF you can specify details of your website or other FTP location and your PDF will be created and uploaded in one step.

Another usesful addition to MakePDF is SearchPDF which lets you find PDFs which contain certain text (see below for details).

Setting Up MakePDF

  1. Download the Ghostscript application (see below for link) and install it.
  2. Set up a new printer in Windows using any available Postscript printer driver (preferably a colour printer - I used the HP Paintjet XL300 Postscript and renamed it "PostscriptFile") and set the port to either "FILE:" or to a specific file name (I use C:\Windows\Desktop so that I can easily double click it when I want to ). You should also set the "Spool Settings" to "Print Direct To Printer".
  3. Place MailPDF.EXE (and MailPDF.Exeas well if required) in any convenient directory (Note: MailPDF must be in the same directory as MakePDF if you use it).
  4. Open MakePDF and point it to your Ghostscript executable file when prompted.
  5. If desired, specify MakePDF as the default "Open" program for a particular file extension (in Windows Explorer: go to View - Options - File Types - New Type) and include any desired switches in the command line ( I use "C:\Program Files\MakePDF\MakePDF.EXE" %1 /S /X /L /Q /D)

Creating PDF documents:

Interactive

  1. Create your document in the application of your choice (MS Word, Excel or whatever)
  2. Print the document to the PostscriptFile printer.
  3. Locate the resulting Postscript file and double click, right click and select MakePDF or drag onto the PDF icon. Or open MakePDF and use the "Browse" button to locate your Postscript file.
  4. A dialog box appears, set any switches required and click on a button to create the appropriate version of PDF file.

From a Command Line or Batch File

You can also invoke MakePDF from the commandline or a batch file. If you include a /V1.2 ,/V1.3 or /V1.4 after the filename, MakePDF will automatically create the appropriate PDF file and then terminate without any dialog boxes or user interaction.

Directly from another application

I now use MakePDF to automate the creation and distribution of of MS Word and Excel documents. I use MakePDF's companion program MailPDF to allow me to automatically create and email reports in MS Access. You can use similar approaches to do this from any program which supports macros or procedures which can invoke another application. The following are examples of using MakePDF/MailPDF with Microsoft applications.

MS Word/Excel and MakePDF

For MS Word, you can place the following macro in your Normal.DOT template and place a button pointing to it on a suitable toolbar. Then you can print the current document as a PDF and open a new mail message with it already attached - all with a single mouse click.

Sub SendPDF()
Dim strShellstr As String Dim strQ As String
'set strQ as a Quote character to delimit long file names containing spaces
strQ = Chr$(34)
'Print to Postscriptfile
ActivePrinter = "Postscriptfile on C:\WINDOWS\TEMP" 'set the appropriate printer
ActiveDocument.PrintOut (False) 'False switch forces macro to wait until file is printed

'Create PDF using MakePDF
'passes the documents "Title" property as the SUbject of the email
'and the document's Name (with a .PDF extension instead of the .DOC extension)
'as the filename
strShellstr = strQ & "C:\Program Files\makepdf\makepdf.exe" & strQ & _
"C:\WINDOWS\DESKTOP\PSCRIPT.PSF /D /V 1.2 /M " & _
ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle) & " /Q /O " & _
strQ & "C:\windows\desktop\" & _
Left$(ActiveDocument.Name, Len(ActiveDocument.Name) - 4) & ".PDF" & strQ
Shell strShellstr

End Sub

MS Access and MailPDF

1. Design a report ("MyReport") and configure it to "print to a specific printer" - specifically, the printer set up for MakePDF to print to a specific file.

Create a Form with a text field to enter the email address (txtAddress) and a command button (cmdSend) and place the following code in the on_click event:

cmdSend_click()
DIM strShellstring as string
DoCmd.OpenReport "MyReport"
strShellstring = Chr$(34) & "C:\Program Files\Makepdf\Mailpdf.exe" & Chr$(34) & " /N " _
& txtAddress & " /I C:\Windows\Desktop\Pscript.psf" & Chr$(34) _
& " /O C:\MyReport /S Attached Report /B Here is the report you wanted"
Shell (strShellstring)
End Sub

Clicking the button will print the report, convert it to PDF and send it to the specified address. Note: Because of the spaces in the path, it is necessary to surround the MailPDF.exe path in the string with quotes (Chr$(34)'s)

SearchPDF

SearchPDF will scan a selected directory branch for PDF files and search each PDF for a given text string. it display all matching and non matching PDF files found in two list boxes. You can then open any selected matching PDF file from within the program. Like MakePDF, it uses AFPL Ghostscript to do all the hard work. In order to use the program, you must have Ghostscript installed. This program also uses the PSTOTXT package, written by Paul McJones and Andrew Birrell of Digital Equipment Corporation's Systems Research Center (see the file pstotext.txt which is included in the downlaod zip file for licencing details).

DOWNLOADS

Note: You need to download and instal Ghostscript as well.

Click here to download MakePDF
(Current versions MakePDF v2.5 - 29Kb - Dec 2002).
Click here to download MailPDF (requires MakePDF as well)
(Current versions MailPDF v1.3 - 12Kb).
Click here to download FTP-PDF (requires MakePDF as well)
(Current versions FTP-PDF v1.0 - 19Kb).
Click here to download SearchPDF
(Current versions SearchPDF v1.1 - 90Kb).

Download Ghostscript from here(5Mb)
You can get Adobe Acrobat Reader here (5Mb).


Trapped in Someone elses frame? CLick her to go to the Lexacorp Home Page

Version History

v1.0 Original Concept

v1.1
Improved Long File Name support
No longer restricted to using .PRN files.
Accepts a filename with any or no extension
If invoked from the commandline with a -V parameter, creates the PDF without opening a dialog box and exits without any messages.

V1.2
Option to automatically delete the input file on completion.
Option to specify the output file name.
Creates a new directory for the output file if necessary. -Q (quiet) command line switch to suppress error messages.

V1.3
Option to automatically view PDF after creation (uses default Windows PDF viewer)
-S command line switch ("Show") to select this option

V1.4
Added browse button to select input file.

V1.5
Accepts wildcards for the input specification in Interactive mode
-L switch to force the output file name to be all lower case AutoExit switch for interactive mode

V1.6
Added a Directory Browse button for selecting an output directory Added Option to make the Output Directory field "sticky" when selecting input files

V1.7
Replaced the Ghostscript Environment variable with an Ini file to simplify set up. Program prompts for the location of Ghostscript when run for the first time.

V1.8
Creates a temporary file for the paramaters to pass to Ghostscript, allowing an increase in the length of filenames to 123 characters each.
Modifications to create v1.4 PDF (requires at least AFPL Ghostscript ver 6.50)

V1.9
Added -M switch to send resulting PDF file to MAPI compliant mail client from the command line

V2.0
If MakePDF is installed in a R/O directory (for instance on a network), the MakePDF.INI file will be placed in the users Windows directory.
Create the temporary parameters file in the users Temp or Tmp directory rather than the MakePDF directory.
The -M Switch can optionally pass a Subject line for the email.

V2.1 Changed all swithces from " -" to " /" so that the "-" character can be used in filenames etc

V2.2 Separated Output File and Directory boxes
Changed to single "MakePDF" button with PDF Versions as option buttons and a default to v1.4
Prompts to overwrite if PDF exists (unless No Message flag is set)
V2.3 Bug fix - trailing quote in command line caused problems with W2K if the input file was in the root directory
V2.4 Bug fix - Ver 2.3 compiled with new Win32API.inc under PB/Win 7.0 Change in declaration broke the folder Browser.
V2.4 Bug fix with parsing output path when selecting input file with Browse button

Copyright Notice

MakePDF is Copyright Lexacorp Ltd, Dec 2002. It may be used and distributed freely. The program is supplied without warranty of any kind. input file with Browse button

Copyright Notice

MakePDF is Copyright Lexacorp Ltd, Dec 2002. It may be used and distributed freely. The program is supplied without warranty of any kind.