Create a PDF file from virtually any document (after making it a PostScript File).  (Miles Comer 06/20/02) (Update 2009-03-25 Microsoft Office 2007 users can download an add-in that will add a "Save as PDF" option http://tinyurl.com/MSoffice2007pdf )

1.  Create a Virtual PS Printer

2.  Create a PostScript document by printing to a file aimed at the Virtual PS Printer.

3.  Convert this file to PDF with GhostScript.

Notes

 

1.  Create a Virtual PS Printer.

Choose to "Add a New Printer" (My Computer>Printers or My Computer>Control Panel>Printers and other Hardware)

Choose Local Printer and install any printer ending with a PS (IE: HP Laserjet 5/5M PS) and choose to have the port be a File Port (as opposed to LPT1: or COM1:) (keep existing driver if so prompted)

If given the option to name the printer, choose something like "Create_PS_files" to help keep it straight.

 

2.  Create a PostScript document by printing to a file aimed at the Virtual PS Printer.

In most programs it's simply File>Print Choose your "Create_PS_files" printer and make sure the "Print to File" checkbox is checked. Most programs will give you the option of where you want to save it, others will just automatically save in whatever folder the origional file was in, while others aim for the Windows desktop.

 

3.  Convert this file to PDF with GhostScript.

Download a program called "GhostScript". If you can't find it on the web, I've put a copy of the Windows version (specifically I'm running WindowsXP and Windows98SE and it worked on both) at:

ps2pdf.exe

(Be sure to scan all downloaded executables before execution)

Install it wherever (I installed it to "D:\Programs\GS" but it can be installed anywhere).

Find the PostScript file that you created (if you can't find it, run a search for files with a "prn" extension) IE:in the Find what box type in *.prn )

Find the directory you installed GhostScript into, and then open the folder gs7.04 , and then the folder bin , and copy your PostScript file into this bin directory.

 

 

Then open an MS-Dos Prompt:

Start>Run command > Type: cmd and hit enter

And navigate to your install folder (use command "cd.." to move up a level, and "cd foldername" to move into a subfolder).

In the install folder, navigate further down to subfolder:

gs7.04

then to subfolder:

bin

And type in this command:

gswin32c.exe -sDEVICE#pdfwrite -sOutputFile#filename.pdf filename.prn

filename.pdf is what you want the new file to be named

filename.prn is what your PostScript file is named

A realworld example:

At the prompt:

D:\program\gs\gs7.04\bin>

type in:

gswin32c.exe -sDEVICE#pdfwrite -sOutputFile#employ.pdf milespostscriptfile.prn

Then it will run some commands, you'll see a file with the name you gave it pop up in the folder with a 0kb file size. Then the command window your in will pop up the message:

>>showpage, press <return> to continue<<

Press the Return key everytime this comes up, then it will go to a prompt like this:

Gs>

once there type:

quit

and then it will return to your folder prompt.

Go ahead and double click on the new file that was created in the bin folder. (usually with a pdf extension IE: filename.pdf )

 

Notes

Note: Be sure to copy the CASE of the command specifically, I had trouble running it using just all lower-case.

Note: When printing from notepad in WinXP it will automatically default to the users desktop and only prompt you for a filename. (of course you can just enter in a full path and filename and it will write it to that location IE:

Output to File:

c:\filename.prn

Note: Notepad also tends to screw up the word wrapping either way, so i'd aim to print from wordpad (Start>Run wordpad ) or Microsoft Word. For these reasons i don't recommend printing from notepad.

Note: The documentation suggests that you can run commands from within the Gs> prompt, but I had no success in doing so.

Note: Documents that you are concerned about looking a specific way and coming out just perfectly probably won't fair well. If this is your concern (and you job depends on these looking correct) and you want to add all sorts of useful features, then I'd suggest buying Adobe Acrobat, but for small jobs, it works quite well.

Note: I actually didn't write the ghost program that I wrote the instructions too, if you want more information about the ghost program you may try looking at this page:  http://www.cs.wisc.edu/~ghost/index.html   Or try asking technical questions on these lists:   http://www.ghostscript.com/mailman/listinfo/

Note: If your filename has a space in it, you will have to put that filename in quotes. IE: "file name.pdf"  or "file name.prn" for both the input and output file.

Note: It may be possible to include paths to files, that means you can type in "c:\my documents\filename.prn"  Try it and tell me what happens.

Note: Are you getting this message /undefined in +E+&u600D Unrecoverable error, exit code 1 and then it exits back to the command prompt and produces a pdf file of 0 kilobytes?  I've seen it display this behavior when you didn't do step 1.  Create a Virtual PS Printer.  Go back and make sure that you point it to the file port and install any kind of PS printer.

Note: Well I'll be, I tried copying over the gswin32c.exe to a folder on the root of C and ran it, and it worked just like it always has, which means if you want to just copy it to another directory (like just a gs folder on your C: drive) you can, but you still have to install the ps2pdf.exe file to that operating system.

Sorry that this is so quick and dirty, but it's worth what you paid for it.
-Miles Comer 06/20/02


All TinyEmpire.com content is maintained by MilesComer.com and is either copyright of Miles Comer or of it's respective creator. Site maintained by i@milescomer.com  Send a MSG2MILES Go back to TinyEmpire.com home.