53
The easiest way to use scripting is with the Watched Folders (shown
in green in the above diagram). Using the Bluebeam Q Manager, a
batch script can be written that is executed on any file that is dragged
into the specified folder. The Script Editor within the Bluebeam Q
Manager has autocomplete and integrated help to make authoring
scripts as simple as possible. Additionally, the scripting can be run in
conjunction with the conversions that the Watched Folders already
support. For instance, a watched folder can be set up to convert
AutoCAD files to PDF, and then a script could run that adds PDF
Security to the newly converted PDF file. The Watched Folders
support a subset of the scripting commands that work in a batch
environment.
For users with .NET programming capabilities, all of the script
commands are included in the Bluebeam Q API. This is represented
in the preceding diagram by the blue area. Using the API makes more
commands available, and, in contrast to the basic batching done with
watched folders, logic can be applied to the operations done to the
PDF. For instance, with the API, file properties could be queried from
the PDF, and based upon the file properties present in the PDF,
particular stamps could be applied.
Finally, for users who do not use .NET, but still want full access to the
scripting capabilities, scripts can be run directly from the command
line. This is shown in the red “User Application” area of the diagram
on the prior page. The script engine supports two modes: normal and
54
interactive. The normal mode simply runs the script and then exits.
The interactive mode listens to the standard input for commands, and
then writes the results back to the standard output. Using the
interactive mode allows for the same capabilities as the API, but
supports any language that can read and write to standard in and
standard out. Also, a standalone version of the Script Editor is
included with Q to help users write and debug standalone scripts.
The Script Editor resides in
folder. A help file describing the use of the Script
Editor is located in:
.
The Q Conversion API
This section gives a brief overview of the Q API. The complete API
help is part of the Q installation and is located in the following default
folder on the installed system:
C:\Program Files\Bluebeam Software\Help\Bluebeam Q API Help.chm
Q is built on the Microsoft .NET framework v3.5,sp1, however the API
supports .NET 2.0 and later. It is recommended that Visual Studio
2005, 2008 or 2010 be used for development. Bluebeam has supplied
code samples for both C# and VB.NET. Getting started with either
environment is very similar. One important point to note is that using
the API will connect to an existing instance of the server. To use any
of the examples, be sure that the server is already running.
Creating a new Project and adding Reference paths
Any Project type should work with Q, however for the purpose of this
guide, create a Console Application. To do this open Visual Studio
and click$.+3, then select Console Application from
either Visual Basic Projects or from C# Projects. The Q API is located
in the file BBServerAPI.dll which is installed into%2"
$% . After creating the new
project, add a reference to BBServerAPI.dll, then Add the appropriate
include statement as follows:
Visual Basic
Imports Bluebeam.Hydra.LightProgrammaticInterface
C#
using Bluebeam.Hydra.LightProgrammaticInterface;
Simple Example