Jojoxx.net logotyp

 

 

Användare ikonAnvändare
Besökare just nu: 85
Snabblänkar ikonSnabblänkar
JavaScript-arkivet
Perl
FAQ

Sök på Jojoxx.net


FAQ: Perl / CGI

Hur konverterar man enklast en Word-fil (doc/docx) till PDF?

##################################################
# This script relies on the following:
# - Microsoft Word 2007
# - 2007 Microsoft Office Add-in: Microsoft Save as PDF or XPS
#   http://www.microsoft.com/downloads/details.aspx?familyid=4D951911-3E7E-4AE6-B059-A2E79ED87041&displaylang=en
##################################################
#
use FindBin;
use Win32::OLE qw(EVENTS);
my $theDoc = Win32::OLE->new("Word.Application") || die "Could not start Word.Application\n";
$theDoc->{Visible} = 0; # false
$theDoc->{WindowState} = 2; # minimized
$theDoc->Documents->Open("c:/test.docx");
$theDoc->ActiveDocument->SaveAs("c:/test.pdf", 17); # 17 is the magic number for wdFormatPDF
$theDoc->quit();

,