0% found this document useful (0 votes)
1K views6 pages

Word2Pdf Documentation

Word2Pdf is a collection of JavaScript scripts that converts Microsoft Word documents to PDF format. It relies on Word and Ghostscript to perform the conversion. The documentation describes how to install Word2Pdf, use it from the command line or a graphical interface, and lists the files included in the distribution. The architecture uses JavaScript modules to organize the code and keep the namespace uncluttered.

Uploaded by

Antonio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views6 pages

Word2Pdf Documentation

Word2Pdf is a collection of JavaScript scripts that converts Microsoft Word documents to PDF format. It relies on Word and Ghostscript to perform the conversion. The documentation describes how to install Word2Pdf, use it from the command line or a graphical interface, and lists the files included in the distribution. The architecture uses JavaScript modules to organize the code and keep the namespace uncluttered.

Uploaded by

Antonio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Word2Pdf

Documentation
Document Version: 1.2

Converting MS Word DOC, RTF or DOCX files to PDF files

Creative Commons Attribution 2.5 Switzerland License


http://creativecommons.org/licenses/by/2.5/ch/

September 16, 2009


Author: Hartwig Thomas, Enter AG, Zurich, Switzerland

Seite 1/6

Enter AG
Word2Pdf Documentation

Word2Pdf
Documentation
TABLE OF CONTENTS
1

OVERVIEW ............................................................................................................................ 2

DOES ONE NEED YET ANOTHER PDF-WRITER? ....................................................................... 2

PREREQUISITES .................................................................................................................... 3

INSTALLATION ....................................................................................................................... 3

4.1

5
5.1

Uninstall ............................................................................................................................................. 3

USAGE .................................................................................................................................. 4
Graphical User Interface................................................................................................................... 4

ARCHITECTURE ..................................................................................................................... 5

LIST OF FILES........................................................................................................................ 5

OVERVIEW

Word2Pdf is a collection of scripts which permits simple conversion of Microsoft


Word files to the Adobe PDF format. Word2Pdf is called on the command line. A
graphical user interface to its function was not considered to be a high priority.
These scripts of Word2Pdf rely on a valid version of Word for reading and printing
Word files as well as on Ghostscript (http://www.ghostscript.com/) for generating
PostScript files through a PostScript printer and convertings those files to the PDF
format.
Thus, obviously, Word2Pdf can only be run on the Windows platform. It makes use
of cscript.exe and is fully implemented in JavaScript. As a consequence its source
is freely available.
Word2Pdf attempts to produce output which conforms to the PDF/A ISO standard.
XMP metadata, however, are not yet generated in a controlled fashion. Thus a
clean PDF 1.4 with embedded fonts is created.
Word2Pdf was developed by Hartwig Thomas, Enter AG, Zurich, Switzerland and is
freely available under the GNU General Public License, version 3 or any later
version (http://www.gnu.org/licenses/).
For making use of Word2Pdf or its components in a context, which does not
conform to the conditions of GPL v3, please contact the author
([email protected]).

DOES ONE NEED YET ANOTHER PDF WRITER?

If you dont, be glad and forget about this tool. It was developed because we
needed a converter that could be called from the command line in a build script,

Seite 2/6

Enter AG
Word2Pdf Documentation
where the documentation is maintained by many people as a Word file and should
be delivered to the user in PDF format. As we could not find a free tool fulfilling
this requirement, we developed these scripts as a stop gap measure. They may
turn out to be useful for others.
So the only goal of Word2Pdf is to achieve this conversion without interaction with
a graphical user interface. Whoever has the same needs, may find it useful.

PREREQUISITES

For using Word2Pdf you need


a Windows workstation
with MS Word and
Ghostscript installed,
the Word2Pdf distribution as well as
access to Administrator privileges for the installation.
Word2Pdf will convert the Word files, which can be read by your MS Word version,
unless they are encrypted and protected by a password. In that event, please save
an unprotected copy before you attempt the conversion.

INSTALLATION

Before you can use Word2Pdf you have to install it first. For the installation you
need to log on to Windows with Administrator privileges.
You also need to have Ghostscript installed and the GS_LIB environment variable
must point to its lib and fonts folders. In addition its executable gswin64c.exe or
gswin32c.exe must be on the PATH.
The Word2Pdf distribution contains the command script install.cmd in its root
folder. Executing this command (e.g. double clicking on it) will install Word2Pdf on
your Windows workstation.
The installation will
install a FILE: PostScript printer called Enter2Ps based on ghostpdf.inf in
the lib folder of Ghostscript,
copy the files of the distribution to your Programs folder (alternatively you
can indicate another target folder on the command line, when calling
install.cmd),
add the bin folder of Word2Pdf to the System PATH.
4.1

Uninstall

The root folder of the installed Word2Pdf application contains the file
uninstall.cmd. Also for running this command file successfully you will need
Administrators privileges.
It will

Seite 3/6

Enter AG
Word2Pdf Documentation
remove the Word2Pdf entry from the System PATH,
delete almost all Word2Pdf files the folder it was started in (with the
exception of the ones locked by the uninstall process),
remove the PostScript printer Enter2Ps.

USAGE

The bin folder of the Word2Pdf installation contains the file word2pdf.cmd. This
will be excuted, whenever you enter the command word2pdf on the command line,
because its folder was added to the PATH by the installation.
You can enter the command with the following options and parameters:
word2pdf [/h] | [/copy] | [<Options>] <WordFile> [<PdfFile>]

If an argument a file name or an option value contains white space or special


characters, you must enclose it in double quotes.
The only mandatory argument is <WordFile> the name of the word file to be
converted. The name of the PDF file to be produced can be given with the optional
argument <PdfFile>. If it is not specified, it will be created in the same place as
the input file with the same name, but with a pdf extension.
All options concern the metadata. If an option is not given, it is assumed, that the
corresponding information is to be read from the Word file. The following
metadata can be specified :

/a:<Author>

Author of the text

/t:<Title>

Title of the text

/s:<Subject>

Subject of the text

/k:<Keywords>

Keywords of the text

/c:<CreateDate>

Creation date (Format: YYYYMMDD)

/m:<ModDate>

Modification date (Format: YYYYMMDD

The resulting option values used (from the command line and/or from the word
file) are displayed by Word2Pdf. In the PDF file they appear as document
information.
5.1

Graphical User Interface

Alternatively the launcher w2p.js in the bin folder of the Word2Pdf installation can
be started with a double click on the file name or with the command wscript
<path>\w2p.js. This will display a dialog where parameters can be entered and the
command line tool can be launched.

Seite 4/6

Enter AG
Word2Pdf Documentation

ARCHITECTURE

Few JavaScript programmers realize, that JavaScript has become the language of
choice for implementing shell scripts for Windows. With the introduction of the
Windows Scripting Host (WSH), Windows can not only be scripted using the
traditional batch file syntax but also using VBS (Visual Basic for Scripting) or
JavaScript.
Such scripts tend to become large fast. Therefore we have introduced a modicum
of modularity by putting corresponding eval lines at the top of each module.
Each module file is essentially the definition of an object. This helps a lot to keep
the namespace from cluttering up. It also permits using the prototype mechanism
of JavaScript.
These hints should suffice, to make the richly documented code understandable.

LIST OF FILES

The following files are contained in the Word2Pdf distribution:


install.cmd

installation command runs bin\install.js


(not copied to installation)

uninstall.cmd

deinstallation command runs


bin\uninstall.js

bin

folder with executable binaries

bin\word2pdf.cmd

word2pdf command runs word2pdf.js

bin\w2p.js

launcher for word2pdf.cmd

bin\install.js

installation main script (not copied to


installation)

bin\uninstall.js

uninstallation main script

bin\word2pdf.js

conversion main script

bin\cio.js

console I/O module

bin\cmd.js

external command execution module

bin\date.js

date handling module

bin\env.js

environment handling module

bin\fsu.js

file system utilities

bin\gspdf.js

ghostscript PostScript module

Seite 5/6

Enter AG
Word2Pdf Documentation
bin\log.js

log module

bin\printer.js

printer module

bin\utils.js

utilities

bin\word.js

word module

doc

documentation folder

doc\Word2Pdf Documentation.docx

Documentation file

doc\Word2Pdf Documentation.pdf

Converted documentation file

Seite 6/6

You might also like