Penguin
Note: You are viewing an old revision of this page. View the current version.

InNeedOfRefactor: we have too many different pages with partly overlapping information on creating PDFs.

Under Linux

From any PostScript document

Many applications are capable of generating PostScript. Since PDF is actually a container format that relies on PostScript for the actual document image, generating PDFs from PostScript documents is trivial. The GhostScript package processes both formats and comes with a script called ps2pdf(1) (Debian package: gs-common) which does exactly what its name suggests. Older versions of GhostScript (such as the widely used version 5.50) embed any non-core fonts as bitmap fonts, which AcrobatReader doesn't do a very good job of rendering. More recent versions of GhostScript (6.x or 7.x) do a much better job of embedding scalable fonts in the document.

See the notes below for hints about using ps2pdf.

As a special printer

You can set up a fake printer that will generate a PDF file. Most of these techniques are wrappers to ps2pdf. This means you can make a PDF file from any program that can print. See the SambaPDFPrinter and CUPSNotes pages.

From LaTeX documents

You can use LaTeX to make good quality PDF files: PdfLatexNotes or LaTeXpdf are good places to look.

From OpenOffice

Version 1.0 of OpenOffice allows you to set up a special PDF printer. From the correct installation directory (such as /usr/lib/openoffice/program), run ./spadmin, select New Printer and then Connect a PDF converter and then OpenOffice will see its own special extra printer. Debian has a wrapper script called oopadmin that you can run from any directory.

Version 1.1 of OpenOffice does PDF "natively" - it is merely another filetype you can save as, rather than setting up fake printers. It also has Export to PDF... which allows you to save optimised for Size, Print, or Press.


Under Windows

The SambaPDFPrinter described above can almost certainly be shared via samba and printed to from Windows Applications, something similar can probably be done for the CUPS version mentioned above as well. If I ever get around to setting this up I'll wiki the results.

From Word documents

If you don't have any PDF software installed (either Adobe or other), and just want to convert a Word document to PDF, there's an easy-to-use service at http://www.fastpdf.com. You upload your document, and enter your email address, and the service sends you a note when the conversion is done. (You then pick up the conversion from the website.) The service is free for short documents, and relatively inexpensive for longer docs ('much' cheaper than purchasing Adobe's software!). Note: this is a somewhat shameless plug (since I built the thing), but many people do find it convenient.

As with any PDF conversion service, Fast PDF can get confused by unusual fonts found in Word docs. But if you embed the fonts you use in your document prior to submitting it to the service, the service works very well.

PDFs with Macrons from Word documents

This can be a problem when the document contains Macrons and other characters not in all the standard character sets. The following technique appears to work at least in some cases where you have a PostScript printer visible and Adobe PDFWriter installed.

  1. Open the document in Word
  2. From the File / Print... dialog, select a PostScript printer and check the Print to file checkbox
  3. Hit Ok and supply a filename to save the .prn file with
  4. Open Notepad, and open the .prn in Notepad (not by double clicking it)
  5. The first line of the .prn should be quite long and contain lots of junk. Delete everything up to the "%!PS-Adobe-3.0". These must be the first characters in the file.
  6. Save the result as a .ps file
  7. Double clicking on the .ps file should launch Adobe PDFWriter to automatically create a PDF

The PDF file will almost certainly look dreadful because all the fonts that make things look nice on the screen got thrown away in the Print to file step. It should print nicely however.

For those without the budget for the full Acrobat, you can use the ps2pdf(1) program from GhostScript mentioned in the Linux section above.

From Publisher, for online publishing

You can use the MS Imagesetter Printer that is created by the Commercial Printer option when installing Publisher. This creates a pair of pseudo-printers on a Windows box, which can be used to Print to file if the app doesn't support such. The printers are called MS Publisher Colour Printer and MS Publisher Imagesetter and both are capable of colour. The Imagesetter one seems to work better.


ps2pdf hints

  • ps2pdf is really just a wrapper script that calls gs with the correct options, such as -sDEVICE=pdfwrite (meaning to use the "pdfwrite" output device). Make sure you are using the most recent version of GNU ghostscript, since each version seems to improve greatly on previous versions. (Current version in debian testing at time of writing is 7.07).
  • If you are trying to make a pdf from a postscript file that has a funny size (ie, using "gv" shows it is using the !BoundingBox), use the "-dEPSCrop" option. Otherwise it will default to landscape A4 and probably things wrong.
  • If your document is black-and-white/grayscale, you might be able to make use of some optimisations by adding "-dProcessColorModel=/!DeviceGray?" as a command-line option.
  • You can add a -r<n> option for the resolution... eg a low resolution like -r75 if you are only creating a PDF designed to be viewed on-screen.

Under MacOSX

The following have been tested under OSX 10.3 (Panther) only; someone else might want to confirm them on earlier versions.

  • From most applications (Safari, iCal, !TextEdit? and Preview etc...), you can select Print from the File menu and click on the Save As PDF... button and select your destination for your PDF.
  • From Preview, you can also select Export from the File menu, select PDF from the Format pulldown menu and select your destination for your PDF.