Script to convert Postscript to PDF



I needed to convert lots of Word files to PDF. This script automates the second step, convert Postscript to PDF.

use Win32;
use Win32::API;
use Win32::OLE;
use Win32::OLE qw(in);
sub ps2pdf {
	my $psfile = shift;
	my $pdffile = shift;
	my $distiller = Win32::OLE->new('PDFDistiller.PDFDistiller.1')
		or die Win32::OLE->LastError;
	$distiller->FileToPDF($psfile, $pdffile, 'Print');
}

Leave a Reply