Corda Embedder Methods

This section describes each of the methods of Corda® Embedder. These methods perform a variety of tasks, such as loading data files or generating embedding HTML for the Corda image.

Note: The code in the syntax section of these descriptions assumes that you are manipulating a Corda Embedder object named myImage.

Important: Unless otherwise noted, the method calls specified in the Java* examples also apply to C#.

For a list of Corda Embedder methods, see Class Summary.

 

void

 

addHTMLTable

Available only in Corda 7 Enterprise

Syntax

 

myImage.addHTMLTable(object, title);

Alternate Syntax

 

ASP (VBScript) | Java* Tag Library | PERL | PHP

Description

 

Instructs Corda Server" to return an HTML table containing the data for the specified graph or map. The HTML table appears below the Corda image. Additionally, the table contains an extra column and/or row for data summation.

Calling addHTMLTable more than once creates multiple HTML tables, which appear below the Corda image in the order added. Or, if you call this method without any parameters, Corda Server adds an HTML table for all graph objects in the Image Template file.

For more information about HTML Tables, see HTML Data Tables.

Parameters

 

The addHTMLTable method accepts the following parameters:

Important: Due to limitations in the Component Object Model, addHTMLTable always requires two arguments in COM environments, even if you have no need to set the last parameter. If you don’t need to set the title, set it to an empty string (for example,  myImage.addHTMLTable "graph", "").

 

 

object

String

 

 

The name of the graph or map object for which you want to return an HTML Table. For example, for graphs this name is usually graph, but check the Image Template file to be sure. If the specified object does not exist, the method is ignored.

This parameter is optional (except in COM environments.) If it is not included, Corda Server returns an HTML Table for all graphs and maps.

 

 

title

String

 

 

The title for the HTML Table. This parameter is used as the value for the title attribute of the <table> tag.

This parameter is optional (except in COM environments.) If it is not included, Corda Server tries to give the table a title by looking for a textbox named title. If it cannot find one, the table title is omitted.

Example

 

Adding an HTML Table

myImage.addHTMLTable("graph","My Data");

 

void

 

addObjectParamTag

Syntax

 

myImage.addObjectParamTag(name, value);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Adds a <param> tag to Corda images that are embedded using an <object> tag. Currently, this includes FLASH and PDF images in Internet Explorer only. This allows you to extend the functionality of the plug-ins that are used to display Corda images.

One common use for this method is to set the display mode of a FLASH object to transparent, so that dynamic HTML properties (such as menus) overlaps the image if they have a higher z-index value than the FLASH object. The FLASH plug-in allows you to do this by adding the following <param> tag to the <object> property.

<param name="WMODE" value="transparent" />

To have the Corda Embedder add this <param> tag to the FLASH Corda image, you would make the following method call.

myImage.addObjectParamTag("WMODE","transparent")

Parameters

 

The addObjectParamTag method accepts the following parameters:

 

 

name

String

 

 

The value of the name attribute for the <param> tag that you are creating.

 

 

value

String

 

 

The value of the value attribute for the <param> tag that you are creating.

 

void

 

addITXML

Syntax

 

myImage.addITXML(XMLString);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Sends the specified ITXML statement to Corda Server.

Any ITXML added through this method is appended after all of the loadITXML methods are processed. PCScript is processed after all ITXML has been processed.

For more information about using ITXML, see ITXML.

Parameters

 

The addITXML method accepts the following parameters:

 

 

XMLString

String

 

 

The ITXML that should be sent to Corda Server.

Example

 

Streaming ITXML to Corda Server

myImage.addITXML("<cit:data><cit:column name='Arrivals'/><cit:column name='Departures'/><cit:column name='Unused'/><cit:column name='Out of Commission'/><cit:row name='Atlanta'><cit:data-item value='23.0'/><cit:data-item value='36.0'/><cit:data-item value='11.0'/><cit:data-item value='7.0'/></cit:row><cit:row name='Boston'><cit:data-item value='41.0'/><cit:data-item value='17.0'/><cit:data-item value='25.0'/><cit:data-item value='9.0'/></cit:row></cit:data>");

 

 

void

 

appendDoc

Syntax

 

myImage.appendDoc(docSource, isPDF);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Converts the specified secondary document to PDF and appends it to primary PDF.

This method allows you to specify secondary documents to append to the primary PDF. These documents are sequentially appended in Highwire's final PDF output. This allows you to create one PDF document out of several different Web pages. For example, if each chapter of a book were stored on a different Web page, you would use this command on each chapter of the book to produce one PDF file containing all of the chapters.

Append both HTML source and existing PDF documents using this command. The PDF documents are not translated—Highwire" passes them directly through to the PDF output. To indicate that a document is PDF instead of HTML, set the isPDF parameter to true.

Note: If appendDoc is used in conjunction with loadDoc, all content specified using loadDoc is placed first in the PDF.

Parameters

 

The appendDoc method accepts the following parameters:

 

 

docSource

String

 

 

The path to and location of the document to be appended to the input buffer. Specify an absolute path or URL.

Make sure that the file is accessible to the machine that Corda Server runs on. Also make sure that the path.xml file permits Corda Server to read from this path (see Setting Path Permissions in the Corda 7 Install and Administration manual).

 

 

isPDF

boolean

 

 

(Conditional) Specifies whether or not the document specified in the first parameter is a PDF document. Set this parameter to true if it is PDF. If you set this parameter to false, or do not use this parameter, the document is assumed to be HTML.

Examples

 

Appending HTML Documents

myImage.loadDoc("http://mystory.com/chapter1.html");

myImage.appendDoc("http://mystory.com/chapter2.html");

myImage.appendDoc("http://mystory.com/chapter3.html");

Appending PDF Documents

myImage.loadDoc("report.htm");

myImage.appendDoc("boilerplate.pdf", true);

 

void

 

getBytes

Not available in the Java Tag Library.

Syntax

 

myImage.getBytes();

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Returns a byte array representation of the Corda image, suitable for saving or for returning to a client.

For example, to save a Corda image in Java, create a new DataOutputStream and write the results of this method using the writebytes method, as shown in the example below.

Saving the Results of getBytes

FileOutputStream saveImage = new FileOutputStream(filename);

byte ba[] myImage.getBytes();

saveImage.write(ba,0,ba.length);

saveImage.close();

You can also use this method to return an image to a browser. Tell the browser the length of the image and the image's mime type. Table of MIME Types lists the mime types for each of Corda Server's image formats.

The example below shows how to return a Corda image using getBytes in a Java servlet.

Returning the Results of getBytes to a Browser

response.setContentType("application/x-shockwave-flash");

byte ba[] = myImage.getBytes();

ServletOutputStream os = response.getOutputStream();

os.write(ba,0,ba.length);

os.close();

To learn more about how to use this method in Web applications, see Returning Images Directly from Web Applications.

 

byte

 

getBytesNTO

Not available in the Java Tag Library.

Syntax

 

myImage.getBytesNTO();

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Returns a byte array representation of the Corda image, suitable for saving or for returning to a client.

This method works exactly like getBytes, except that it does not time out after 30 seconds (as the getBytes method does). This method is ineffecient for normal document conversions, and should be used only for very large document conversions for which Corda Server may require more than 30 seconds.

Important: This method requires you to set a password via the password command.

 

String

 

getCordaEmbedderVersion

Syntax

 

myImage.getCordaEmbedderVersion();

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Returns the version of the Corda Embedder that you are using.

This method is useful only when you are debugging and need to know what version you are using.

 

String

 

getEmbeddingHTML

Syntax

 

myImage.getEmbeddingHTML();

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Returns a String containing the HTML necessary to embed the Corda image.

This is one of Corda Embedder's most important methods. When embedding a Corda image on a Web page, this is always the last method called, as it essentially "compiles" the Corda image.

This function returns a String, but does not write it to the Web page. How you do it depends on the Web environment. The example below shows how to write the string to an Active Server Page.

To locate information on embedding a Corda image in a particular environment, see Using Corda Embedder.

Examples

 

Writing the Embedding HTML in an Active Server Page

Response.Write myImage.getEmbeddingHTML()

 

void

 

loadCommandFile

Syntax

 

myImage.loadCommandFile(source, encoding);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Instructs Corda Server to load server commands from a server command file.

Commands in a server command file are processed after all other server commands and overrides commands specified outside of the server command file.

For more information on server commands and server command files, see Server Commands.

Parameters

 

The loadCommandFile method accepts the following parameters:

Important: Due to limitations in the Component Object Model, loadCommandFile always requires two arguments in COM environments. If you don't need to set the last parameter, set it to an empty string (for example, loadCommandFile "prices.txt","").

 

 

source

String

 

 

The path, relative to <document_root>, to the server command file that Corda Server loads. Specify the path using either path or URL notation.

Make sure that the file is accessible from the machine that Corda Server is running on. Also make sure that path.xml permits Corda Server to read from this path (see Setting Path Permissions in the Corda 7 Install and Administration manual).

 

 

encoding

String

 

 

(Optional) Specifies the character encoding of the file you are loading. Valid character sets include euc-jp, utf-8, shift_jis, and unicode. If you have no idea what character encoding is, you most likely can ignore it.

For information about using international/double-byte characters, see International Fonts and Character Support in the Corda 7 Install and Administration manual.

 

void

 

loadData

Syntax

 

myImage.loadData(graph, source ,method ,table, encoding);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Instructs Corda Server to load data into the specified graph object from one of the following types of data sources: tab-delimited data file, comma-separated value file, XML database file, or table in an HTML file.

Note: This command is for graph objects. For map objects, use loadMapData.

By default, this command replaces all existing data in the graph. However, if you want to append the data from the file to the existing graph data, set the method attribute to append.

Corda Server automatically determines the data format. For more information on loading data and on these data formats, see Connecting to Data Files.

Path.xml must grant Corda Server permission to read files from the specified location, or Corda Server cannot load the data. For more information, Setting Path Permissions in the Corda 7 Install and Administration manual.

Note: This command provides the same functionality as the graph.loadFile PCScript command.

Parameters

 

The loadData method accepts the following parameters:

Important: Due to limitations in the Component Object Model, loadData always requires five arguments in COM environments. If you don't need to set the last three parameters, set them to empty strings. For example, loadData("graph","prices.csv","","","").

 

 

graph

String

 

 

The name of the graph object that you want to load the data into. Usually this is graph, but check the Image Template file to be sure. If the specified graph object does not exist, the method call is ignored.

 

 

source

String

 

 

The path, relative to <document_root>, to the server command file for Corda Server to load. Specify the path using either path or URL notation.

Make sure that the file is accessible to the machine on which Corda Server runs. Also make sure that path.xml permits Corda Server to read from this path (see Setting Path Permissions in the Corda 7 Install and Administration manual).

 

 

method

String

 

 

(Conditional) Supported values include append and replace. Indicates the method for importing the data. If method is set to replace, all data currently in the graph is replaced. If it is set to append, the imported data is appended to any data already in the graph, including data from the Image Template file.

If this parameter is not set, it is assumed to be replace. It must always be set when importing data from HTML tables. It must always be set in COM environments.

 

 

table

String

 

 

(Conditional) The title or number of the table that should be loaded from the Web page. If this parameter is a title, be sure that the title corresponds to the value of the title attribute of the <table> tag. If it is a number, Corda Server imports data from the n th table in the Web page, where n is the number specified.

The example below illustrates how this parameter is used. The first line of code imports data from the table titled pricing on the Web page stats.html. The second line of code imports data from the 11th table on the Web page morestats.html.

Loading an HTML Table from a Web Page

myImage.loadData("graph", "http://www.myserver.com/stats.html", "replace", "pricing")

myImage.loadData("graph", "\\database\morestats.html", "append", "11")

This parameter is required when importing data from HTML tables or in COM environments. Send an empty string if HTML tables are not imported.

 

 

encoding

String

 

 

(Optional) Specifies the character encoding of the file you are loading. Valid character sets include euc-jp, utf-8, shift_jis, and unicode.

If you have no idea what character encoding is, you most likely can ignore this parameter.

For information about using international/double-byte characters, see International Fonts and Character Support in the Corda 7 Install and Administration manual.

Example

 

Loading a Comma-Separated Value File

myImage.loadData("graph","data/020115.csv");

 

void

 

loadDoc

Syntax

 

myImage.loadDoc(docSource);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Specifies which document Corda Server should load as input.

The specified document should be an HTML or XHTML compliant file. For more information, see Highwire-Specific Tags This document is converted to a Corda image (e.g., a PDF file).

The specified document may be stored in the Corda Server file system or at a URL accessible to the Corda Server. Corda Server must have permission to read from the specified document's folder or domain (see Setting Path Permissions in the Corda 7 Install and Administration manual).

This command cannot be used in conjunction with setDoc. When both are used, this command overrides setDoc. This command also may not be used in conjunction with PopChart- or OptiMap-specific commands. If both are used, the PopChart® and OptiMap" commands are ignored.

Parameters

 

The loadDoc method accepts the following parameters:

 

 

docSource

String

 

 

The path to and location of the input document. Specify an absolute path or URL.

Make sure that the file is accessible to the machine that Corda Server runs on. Also make sure that path.xml permits Corda Server to read from this path (see Setting Path Permissions in the Corda 7 Install and Administration manual).

Example

 

Loading a Document

myImage.loadDoc("C:\docs\july.html"); // loads from Corda Server

myImage.loadDoc("http://myserver.com/getaccount.asp?file=mystatus&account=10987"); // loads from a URL

 

 

void

 

loadFromCordaServer

This is a deprecated command that is disabled by default. Enable it in <product_root>\server\config\server_config.txt by adding the following line:

Server.enable.deprecated.commands=true

Syntax

 

myImage.loadFromCordaServer(source);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Instructs the Corda Server to load a server-side image.

When you use this command, Corda Server does not generate an image, even if image-generating attributes or methods are used. Instead, it returns the specified server-side image.

After specifying a server-side image using this method, call getEmbeddingHTML or getBytes, because the loadFromCordaServer parameter is not sent to the Corda Server until the embedding HTML or byte stream is requested.

Important: It is essential that you set the outputType attribute to the format of the image that you are loading; otherwise, the Corda Server may return the wrong mime type, causing the browser to be unable to display the image.

This method is most often used in conjunction with the saveToCordaServer method.

Parameters

 

The loadFromCordaServer method accepts the following parameters:

 

 

source

Filename

 

 

The path, relative to <document_root>, to the image for Corda Server to load. If the image is not in <document_root>, specify an absolute path.

Make sure that the file is accessible to the machine that Corda Server runs on, and that path.xml permits Corda Server to read from this path (see Setting Path Permissions in the Corda 7 Install and Administration manual).

 

void

 

loadMapData

Syntax

 

myImage.loadMapData(map, layer, source, table, encoding);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Instructs Corda Server to load data into the specified map object from one of the following types of data sources: tab-delimited data file, comma-separated value file, XML database file, or table in an HTML file.

notE: This command is for map objects. For graph objects, use loadData.

When using this command, specify the map layer you want to target. Make sure you confirm the correct layer name for the specific map that you are working with. The data is applied to that layer only. If the data file names an object that is not in the specified layer, that object is ignored.

Corda Server automatically determines the data format. For more information on loading data and on these data formats, see Connecting to Data Files.

Path.xml must grant Corda Server permission to read files from the specified location, or Corda Server cannot load the data. For more information, see Setting Path Permissions in the Corda 7 Install and Administration manual.

notE: This command provides the same functionality as the map.loadMapFile PCScript command.

Parameters

 

The loadMapData method accepts the following parameters:

Important: Due to limitations in the Component Object Model, loadMapData always requires five arguments in COM environments. If you don't need to set the last two parameters, set them to an empty string. For example, loadMapData("map","prices.csv","areas","","").

 

 

map

String

 

 

The name of the map object that you want to load the data into. If the specified map object does not exist, the method is ignored.

 

 

layer

String

 

 

The layer of the map that you want to send data to. For more information on map layers, see Map Layers in the Corda Builder" User Guide.

 

 

source

Filename | URL

 

 

The path, relative to <document_root>, to the server command file for Corda Server to load. Specify the path using either path or URL notation.

Make sure that the file is accessible to the machine that Corda Server runs on, and that path.xml permits Corda Server to read from this path (see Setting Path Permissions in the Corda 7 Install and Administration manual).

 

 

table

String

 

 

(Conditional) The title or number of the table that should be loaded from the Web page. If this parameter is a title, be sure that the title corresponds to the value of the title attribute of the <table> tag. If it is a number, Corda Server imports data from the n th table in the Web page, where n is the number you specify.

The example below illustrates how this parameter is used. The first line of code imports data from the table titled pricing on the Web page stats.html. The second line of code imports data from the 11th table on the Web page morestats.html.

Loading an HTML Table from a Web Page

myImage.loadMapData("map", "Points", "http://www.myserver.com/stats.html","pricing")

myImage.loadMapData("map", "Points", "\\database\morestats.html", "11")

This parameter is required when importing data from HTML tables or in COM environments. Send an empty string if HTML tables are not imported.

 

 

encoding

String

 

 

(Optional) Specifies the character encoding of the file you are loading. Valid character sets include euc-jp, utf-8, shift_jis, and unicode. If you have no idea what character encoding is, you most likely can ignore this parameter.

For information about using international/double-byte characters, see International Fonts and Character Support in the Corda 7 Install and Administration manual.

Example

 

Loading a Comma-Separated Value File

myImage.loadMapData("map","areas","data/020115.csv");

 

void

 

loadITXML

Syntax

 

myImage.loadITXML(source);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Instructs Corda Server to load a ITXML file. The contents of this file is appended to any other ITXML files that are loaded, including the Image Template file.

Any ITXML added through the addITXML method is appended after all of the loadITXML methods are processed.

For more information about ITXML, see ITXML.

Parameters

 

The loadITXML method accepts the following parameters:

 

 

source

Filename | URL

 

 

The path, relative to <document_root>\image_templates, to the ITXML file for Corda Server to load. Specify the path using either path or URL notation.

Make sure that the file is accessible to the machine that Corda Server runs on, and that path.xml permits Corda Server to read from this path (see Setting Path Permissions in the Corda 7 Install and Administration manual).

 

void

 

lockPDF

Syntax

 

myImage.lockPDF(userPasswd, ownerPasswd, lockCode, highEnc);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Encrypts the PDF document. Also allows you to set the encryption level (40-bit or 128-bit), user and owner passwords, and a locking code (specifies what a user can do with a document, such as print, view, or modify).

This method can be used in three different ways:

  • If you don't send any parameters, the document is encrypted using 40-bit encryption, default locking codes, and without passwords.

  • You can specify three parameters: a user password (the password needed to view the document), an owner password (the password needed to modify the document), and a locking code. If you do not want to require one or both of the passwords, use an empty string. The locking code should be an integer that represents the locking attributes for the Corda image. The most common locking attributes and attribute combinations are enumerated as constants in the Corda Embedder. These constants are listed in PDF Locking Codes.

    For example, if you want to allow a user to do everything with the document, you can simply set the third parameter to CordaEmbedder.AllowAll, or build a locking code by listing the attributes to allow, with each of them separated by the bitwise or operator. This method is demonstrated in the last line of code in the PDF Encryption example below.

  • You can add a fourth parameter to this method to change the encryption level. By default, the encryption level is 40-bit. However, if you set the fourth parameter to true, the encryption level changes to 128-bit.

Parameters

 

The lockPDF method accepts the following parameters:

Important: Due to limitations in the Component Object Model, lockPDF always requires four arguments in COM environments. If you don't need to set all four parameters, use empty strings or default parameters. For example,  lockPDF("","",2580,false).

 

 

userPassword

String

 

 

The user password for the Corda image. A user must enter this password to open the document. If you do not want to require a password, set this value to an empty string.

 

 

ownerPassword

String

 

 

The owner password for the Corda image. A user must enter this password to modify the document. If you do not want to require a password, set this value to an empty string.

 

 

lockCode

int

 

 

The locking code for the Corda image. This value should be an integer computed by using the bitwise or operator on the PDF locking attributes you want this document to have. This technique is illustrated in the third line of the PDF Encryption example below.

The codes for the various locking attributes can be found in PDF Locking Codes. That section also lists the various constants provided in the Corda Embedder for PDF locking codes. If you're not sure which locking attributes you'd like for the Corda image, set this value to CordaEmbedder.AllowDefaults, as in the second line of the PDF Encryption example below.

 

 

highEnc

true|false

 

 

Specifies whether the document uses 128-bit encryption. If this parameter is set to false or it is omitted, 40-bit encryption is used. Set this attribute to true for 128-bit encryption.

Example

 

PDF Encryption

myImage.lockPDF(); //locks the document with no passwords and default settings

myImage.lockPDF("","password",CordaEmbedder.AllowDefaults); //locks the document with an owner password and default locking settings

myImage.lockPDF("passwordA","passwordB",CordaEmbedder.AllowCopy | CordaEmbedder.AllowPrinting | CordaEmbedder.AllowScreenReader,true); //locks the document with 128-bit encryption, a user and owner password, and allows copying, printing, and screen readers

 

 

void

 

promptToSave

Syntax

 

myImage.promptToSave(filename);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Prompts users for a location on their computers to save the generated Corda image. The Web browser does this instead of opening the document immediately.

If you set a document name in setOutputName, the document name defaults to the name specified, but you can also specify a different default name using this method's filename parameter. In either case, however, the user can choose to save with a different name.

Parameters

 

The prompToSave method accepts the following parameters:

 

 

filename

Filename

 

 

The default name for the saved Corda image. The user has the option to override this name.

 

void

 

reset

Not valid with Java Tag Library.

Syntax

 

myImage.reset();

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Clears most data and formatting strings, including ITXML and PCScript. This command is intended to help facilitate the reuse of the Corda Embedder object within the same Web page.

 

void

 

saveToAppServer

Syntax

 

myImage.saveToAppServer(path, name);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Saves the generated Corda image to the specified path and location on the Web application server.

Note: If you want to save the file to Corda Server as opposed to the application server, use the saveToCordaServer method.

Parameters

 

The saveToAppServer method accepts the following parameters:

 

 

path

File path

 

 

Specifies an absolute local path to which you want to save the file.

This path must be in an existing directory on the application server, and you must have permission to write to this path. Permissions are granted by the operating system on a user-by-user basis. For more information, contact a system administrator.

 

 

name

Filename

 

 

The file name for the saved image. Corda Server automatically overwrites the file if it already exists.

 

void

 

saveToCordaServer

Syntax

 

myImage.saveToCordaServer(name);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Saves the generated Corda image to the specified Corda Server location.

Important: A password is required (using the password attribute) to save images. Also, you must have permission to save the file to the location that you specify (see Setting Path Permissions in the Corda 7 Install and Administration manual).

Saving the image to Corda Server allows you to load it later using loadFromCordaServer. Under certain circumstances, this strategy can increase a server's capacity. For example, if a particular Corda image is viewed often, save it to Corda Server the first time that someone requests it, and then use loadFromCordaServer to load it each subsequent time that someone requests it. The result is that Corda Server generates only one image, no matter how often it is requested. Since image generation is the most demanding task for Corda Server, this greatly decreases the server load.

Note: If you want to save the file to the Web application server, use the saveToAppServer method.

Parameters

 

The saveToCordaServer method accepts the following parameters:

 

 

name

Filename

 

 

The path (relative to <document_root>) that you want to save the image to. Make sure that path.xml permits Corda Server to read from this path (see Setting Path Permissions in the Corda 7 Install and Administration manual). Corda Server automatically overwrites the file if it already exists.

 

void

 

setCookieHeader

Syntax

 

myImage.setCookieHeader(headerString);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Allows the user to set the value of the HTTP cookie header. This method is typically used with secure Web sites. The cookie header can be configured to pass a session identifier that is used by the Web server to grant access to secure content.

Parameters

 

The setCookieHeader method accepts the following parameters:

 

 

headerString

String

 

 

Specifies the particular string that should be inserted into the cookie header.

 

void

 

setData

Syntax

 

myImage.setData(graph, data);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Instructs Corda Server to use this data in the specified graph object. This data must be in one of the following formats: tab-delimited data file, comma-separated value file, XML database file, or table in an HTML file. For more information, see Connecting to Data Files.

Note: This command is for graph objects. For map objects, use loadMapData.

Parameters

 

The setData method accepts the following parameters:

 

 

graph

String

 

 

The name of the graph object you want to set the data for. Usually this is graph, but check the Image Template file to be sure. If the specified graph object does not exist, the method call is ignored.

 

 

data

String

 

 

The actual data that should be sent to the graph, in one of the following formats: tab-delimited data file, comma-separated value file, XML database file, or table in an HTML file. For more information, see Connecting to Data Files.

 

void

 

setDBQuery

Syntax

 

myImage.setDBQuery(graph, driver, database, user, password, query);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Instructs the Corda Embedder to make an SQL query to the specified database, then loads the resulting data into the specified graph. This process replaces any existing graph data.

Note: This command is for graph objects. For map objects, use setMapDBQuery.

SetDBQuery can connect to any type of database, as long as that database has a JDBC driver (for Java), or has been set up as an ODBC data source on the computer running Corda Server (for COM environments).

Note: For JDBC data sources, be sure that the driver is included in the classpath or header for the application.

The examples below illustrates how to call this method in Java, C# and ASP. For more information about using databases with Corda Embedder, see Importing Data Directly.

Parameters

 

The setDBQuery method accepts the following parameters:

 

 

graph

String

 

 

The name of the graph object that you want to import the data into. Usually this is graph, but check the Image Template file to be sure. If the specified graph object does not exist, the method is ignored.

 

 

driver

String

 

 

In Java, this is the JDBC driver name. Make sure this driver has been included in the classpath for the Web application.

For .NET, this parameter is not used and should be set to an empty String.

 

 

database

String

 

 

In Java, this is the database URL (e.g., jdbc:obdc:bcdemo).

For ASP/ASP.NET, this is the DSN name of the ODBC database you want to connect to. SetDBQuery also supports a global.asa file, or a DSN-less connection. For more information, see DSN-Less Connections and Connecting to Queries Specified in a global.asa File.

 

 

user

String

 

 

A valid user name for the database. If no user name is required, set this parameter to an empty String.

 

 

password

String

 

 

The user password. If no password is required, set this parameter to an empty String.

 

 

query

String

 

 

The SQL query that you want to make.

Examples

 

Importing Data From a Database in Java

myImage.setDBQuery("graph", "sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:bcdemo", "corda", "secretpassword", "Select Description, OnHand from parts order by Description");

 

Importing Data From a Database in C#

myImage.setDBQuery("graph", "", "bcdemo", "corda", "secretpassword", "Select Description, OnHand from parts order by Description");

 

Importing Data from a Database in ASP

myImage.setDBQuery "graph", "", "bcdemo", "corda", "secretpassword", "Select Description, OnHand from parts order by Description"

 

 

void

 

setDoc

Syntax

 

myImage.setDoc(docString, basepath, encoding);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Specifies the contents of a document Corda Server should load as input.

This method requires two parameters and accepts an optional third parameter. The first parameter should be a string containing the complete HTML- or XHTML-compliant document. For more information, see Highwire-Specific Tags.

The second parameter is the base URL of the document. That is, the location from which Corda Server obtains any referenced images or stylesheets. For example, suppose that the document you want to convert contains the following tag: <img src="button.gif"/>. Unless you tell Corda Server the base URL to the button.gif file, Corda Server cannot find this file.

The last (and optional) parameter specifies the encoding of the document you want to convert.

This method cannot be used in conjunction with loadDoc. When both are used, loadDoc overrides this command. It also may not be used in conjunction with PopChart- or OptiMap-specific commands. If both are used, the PopChart and OptiMap commands are ignored.

Parameters

 

The setDoc method accepts the following parameters:

Important: Due to limitations in the Component Object Model, setDoc always requires three arguments in COM environments. If you don't need to set the last parameter, set it to an empty string. For example,  setDoc(docString,basepath,"").

 

 

docString

XHTML

 

 

The XHTML source for the document you want to convert.

 

 

basepath

Path

 

 

The base path for all referenced files within the docString. This includes images and stylesheets. This path should be a URL or relative directory path from which Corda Server can read images and stylesheets referenced by the document.

Make sure the base path is accessible to the machine on which Corda Server runs. Also make sure that path.xml permits Corda Server to read from this path (see Setting Path Permissions in the Corda 7 Install and Administration manual).

 

 

encoding

String

 

 

(Optional) Specifies the character encoding of the document you are sending to Corda Server. Valid character sets include euc-jp, utf-8, shift_jis, and unicode.

If you have no idea what character encoding is, you most likely can ignore this parameter.

For information about using international/double-byte characters, see International Fonts and Character Support in the Corda 7 Install and Administration manual.

Example

 

Setting a Document

String myHTML = "<html><head><title>My Document</title>...";

myImage.setDoc(myHTML,"...","unicode");

 

void

 

setDocRoot

Syntax

 

myImage.setDocRoot(docRootPath);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Specifies a path or URL that should be used to resolve all relative paths beginning with a forward slash "/".

By default, relative paths beginning with a forward slash are resolved from the root of the current drive for file paths, or the root of the Web server for URLs. For example, the image path /images/spacer.gif referenced within the file C:\Inetpub\wwwroot\test\index.html would resolve to C:\images\spacer.gif. Likewise, the same image path referenced from the Web page http://localhost/test/index.html would resolve to http://localhost/images/spacer.gif.

In contrast, by defining setDocRoot("C:\Inetpub\wwwroot\"), the example above causes the path /images/spacer.gif to resolve to C:\Inetpub\wwwroot\images\spacer.gif. Similarly, defining setDocRoot("http://localhost/test/") causes /images/spacer.gif to resolve to http://localhost/test/images/spacer.gif.

Note: The specified docRootPath should always end with a slash, either forward (/) or back (\).

Parameters

 

The setDocRoot method accepts the following parameters:

 

 

docRootPath

String

 

 

Specifies the appropriate root path used with any relative link encountered during the document conversion process.

 

void

 

setLinkBehavior

Syntax

 

myImage.setLinkBehavior("nolink"|"Web browser");

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Specifies the behavior for links in the Corda image.

The default setting is Web browser, which means external links in the converted Corda image opens a Web browser window to the specified URL. Internal links go to the specified target within the Corda image.

The only other setting is nolink, which means all links are ignored in the Corda image. Link styles are not rendered, and the links are not enabled.

Parameters

 

The setLinkBehavior method accepts the following parameters:

 

 

behavior

nolink | Web browser

 

 

The link behavior can be either Web browser (links open in a Web browser) or nolink (links are ignored).

 

void

 

setMapData

Syntax

 

myImage.setMapData(map, layer, data);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Instructs Corda Server to use this data in the specified map object. This data must be in one of the following formats: tab-delimited data file, comma-separated values, XML data file, or HTML table. For more information, see Connecting to Data Files

When using this command, you must specify the map layer to target. The data is applied to that layer only. If the data file names an object that is not in the specified layer, that object is ignored.

Note: This command is for map objects. For graph objects, use setData.

Parameters

 

The setMapData method accepts the following parameters:

 

 

map

String

 

 

The name of the map object that you want to set the data for. If the specified map object does not exist, the method call is ignored.

 

 

layer

String

 

 

The layer of the map that you want to send data to. For more information on map layers, see Map Layers in the Corda Builder User Guide.

 

 

data

String

 

 

The actual data that should be sent to the map, in one of the following formats:tab-delimited data file, comma-separated value file, XML database file, or table in an HTML file. For more information, see Connecting to Data Files

 

void

 

setMapDBQuery

Available only for Java and .NET versions of Corda Embedder.

Syntax

 

myImage.setMapDBQuery(map, layer, driver, database, user, password, query);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Instructs the Corda Embedder to make an SQL query to the specified database. The resulting data is loaded into the specified map, replacing any existing data.

Note: This command is for map objects. For graph objects, use setDBQuery.

When using this command, you must specify the map layer target. The data is applied to that layer only. If the data file names an object that is not in the specified layer, that object is ignored.

SetMapDBQuery supports any type of database, as long as it has a JDBC driver (for Java) or has been set up as an ODBC data source on the computer running Corda Server (for COM environments).

Note: For JDBC data sources, be sure that the driver is included in the classpath or header for the application.

The Importing Data From a Database in Java example below illustrates how to call this method in Java. The Importing Data From a Database in ASP example below illustrates how to call this method in ASP. For more information about using databases with Corda Embedder, see Importing Data Directly.

Parameters

 

The setMapDBQuery method accepts the following parameters:

 

 

map

String

 

 

The name of the map object that you want to import the data into. If the specified map object does not exist, the method is ignored.

 

 

layer

String

 

 

The layer of the map that you want to send the data to. Make sure to confirm the correct layer name for the specific map with which you are working.

 

 

driver

String

 

 

In Java, this is the JDBC driver name. Make sure this driver has been included in the classpath for the Web application.

For .NET, this parameter is not used and should be set to an empty String.

 

 

database

String

 

 

In Java, this is the database URL (e.g., jdbc:obdc:bcdemo).

For ASP/ASP.NET, this is the DSN name of the ODBC database that you want to connect to. SetMapDBQuery can also connect to a global.asa file or with a DSN-less connection. For more information, see DSN-Less Connections and Connecting to Queries Specified in a global.asa File.

 

 

user

String

 

 

A valid user name for the database. If no user name is required, set this parameter to an empty String.

 

 

password

String

 

 

The user's password. If no password is required, set this parameter to an empty String.

 

 

query

String

 

 

The SQL query to make.

Examples

 

Importing Data From a Database in Java

myImage.setMapDBQuery("map", "Data Points", "sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:bcdemo", "corda", "secretpassword","Select Description, OnHand from parts order by Description");

 

Importing Data From a Database in ASP

myImage.setMapDBQuery "map", "Background", "", "bcdemo", "corda", "secretpassword", "Select Description, OnHand from parts order by Description"

 

 

void

 

setMapResultSet

Available only for the Java Corda Embedder.

Syntax

 

myImage.setMapResultSet(map, layer, resultSet);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Imports the data from a ResultSet object into the specified map object. The new data replaces any existing data.

Note: This command is for map objects. For graph objects, use setResultSet.

ResultSet is a class in the java.sql package. ResultSet objects are usually returned when you make an SQL query. See the example below for an illustration of how this works.

When using this command, you must specify the map layer to target. The data is applied to that layer only. If the data file names an object that is not in the specified layer, that object is ignored.

For more information about using databases with Corda Server, see Importing Data Directly.

Parameters

 

The setMapResultSet method accepts the following parameters:

 

 

map

String

 

 

The name of the map object that you want to import the data into. If the specified map object does not exist, the method is ignored.

 

 

layer

String

 

 

The layer of the map that you want to send the data to.

 

 

resultSet

ResultSet

 

 

A resultSet is a ResultSet class in Java (java.sql package), or a ADBO.Recordset class in C#. ResultSet objects are usually returned when you make an SQL query. See the example below for an illustration of how this works.

Example

 

Using mapResultSet

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

theConnection = DriverManager.getConnection("jdbc:odbc:bcdemos","corda","secretpassword");

theStatement = theConnection.createStatement();

ResultSet results = theStatement.executeQuery("Select Description, OnHand from parts order by Description");

myImage.mapResultSet("map", "Data Points", results);

 

void

 

setOrientation

Syntax

 

myImage.setOrientation("portrait"|"landscape");

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Specifies the page orientation for the generated Corda image.

By default, the page orientation for all Corda images is portrait. Use this method to override the page orientation.

Note: Change Highwire's default page orientation in page_defaults.txt.

Parameters

 

The setOrientation method accepts the following parameters:

 

 

orientation

portrait | landscape

 

 

The page orientation can be set to either portrait (page is taller than it is wide) or landscape (page is wider than it is tall).

 

void

 

setOutputName

Syntax

 

myImage.setOutputName(filename);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Specifies the file name for the generated Corda image.

In many Web browsers, including Microsoft* Internet Explorer, this file name is the default name for the PDF file when users try to save the file to their computers. Users still have the option to change the file name, however.

This file name is also used if you use the promptToSave method to prompt users to save the document instead of opening it directly in their Web browser (unless you override the name with promptToSave).

Parameters

 

The setOutputName method accepts the following parameters:

 

 

filename

String

 

 

The file name for the generated Corda image.

 

void

 

setPageMargins

Syntax

 

myImage.setPageMargins(marginstring);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Specifies the size of page margins in the generated Corda image.

By default, all page margins are set to.25 inches. Use this method to override all four margins in a page.

Note: Change Highwire's default page orientation in page_defaults.txt.

Parameters

 

The setPageMargins method accepts the following parameters:

 

 

marginstring

String

 

 

A string consisting of four comma-separated margin values representing (in order) the top, right, bottom, and left margins of the page.

If the margin value is a number only (i.e., 12), Corda Server assumes that the value represents a size in pixels. Specify a different unit of measurement by using one of the following abbreviations after the number: in, cm, mm, px, pc, pt, em, or ex.

The example below illustrates several ways to set the page margins.

Example

 

Setting Page Margins

myImage.setPageMargins("1 in, 1.25 in, 1 in, 1.25 in");

myImage.setPageMargins("50mm,2cm, 20pt, 50 px");

 

void

 

setPageSize_

Syntax

 

myImage.setPageSize(pagesize);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Specifies the page size for the generated Corda image.

The default page size for all Corda images is Letter. Highwire automatically resizes the page if it cannot fit the entire width of the document in the default page size. However, if you want to explicitly specify the page size, use this method.

Note: Change Highwire's default page orientation in page_defaults.txt.

Parameters

 

The setPageSize method accepts the following parameters:

 

 

pagesize

String

 

 

The page size should be set to one of the following standard page sizes: 11x17, A3, A4, A5, B4, B5, halfletter, ledger, legal, letter, or note.

 

boolean

 

setPDFEmbedFonts

Syntax

 

myImage.setPDFEmbedFonts = true|false;

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Specifies whether or not Corda Server should embed fonts in its PDF output. Files that use extended characters should always embed fonts, or extended characters may not print in the resulting PDF document.

However, preventing font embedding reduces the overall PDF file size, if size is an issue.

 

void

 

setResultSet

Available only for the Java Corda Embedder.

Syntax

 

myImage.setResultSet(graph, resultSet);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Imports the data from a ResultSet object into the specified graph object. The new data replaces any existing data.

Note: This command is for graph objects. For map objects, use setMapResultSet.

ResultSet is a class in the java.sql package. ResultSet objects are usually returned when you make an SQL query. See the example below for an illustration of how this works.

For more information about using databases with Corda Server, see Importing Data Directly.

Parameters

 

The setResultSet method accepts the following parameters:

 

 

graph

String

 

 

The name of the graph object that you want to import the data into. Usually this is graph, but check the Image Template file to be sure. If the specified graph object does not exist, the method is ignored.

 

 

resultSet

ResultSet

 

 

A resultSet is a ResultSet class in Java (java.sql package), or a ADBO.Recordset class in C#. ResultSet objects are usually returned when you make an SQL query. See the example below for an illustration of how this works.

Example

 

Using setResultSet

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

theConnection = DriverManager.getConnection("jdbc:odbc:bcdemos","corda","secretpassword");

theStatement = theConnection.createStatement();

ResultSet results = theStatement.executeQuery("Select Description, OnHand from parts order by Description");

myImage.setResultSet("graph", results);

 

void

 

setTypedData

Syntax

 

myImage.setTypedData(objName, dataString, dataType);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Instructs Corda Server to use this data in the specified graph object. This data must be in one of the following formats: tab-delimited or comma-separated. This method lets you access meta-data that has been specified for each data point using the %_CNAME meta tag. For more information, see META Tags.

Note: This command is for graph objects only.

Parameters

 

The setTypedData method accepts the following parameters:

 

 

objName

String

 

 

Specifies the name of the graph to which this data is applied.

 

 

dataString

String

 

 

Specifies a tab-delimited or comma-separated data set.

 

 

dataType

String

 

 

Specifies how data is organized in the data set. Supported values for this parameter are listed in Supported DataType Values.

 

void

 

setTypedDBQuery

Syntax

 

myImage.setTypedDBQuery(objName, driver, database, user, password, query, dataType);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Instructs the Corda Embedder to make an SQL query to the specified database, then loads the resulting data into the specified graph. This process replaces any existing graph data. setTypedDBQuery makes it much easier to ensure that data from a database query is in the correct format for consumption by the specified graph.

This method also lets you access meta-data that has been specified for each data point using the %_CNAME meta tag. For more information, see META Tags.

Note: This command is for graph objects only.

SetTypedDBQuery can connect to any type of database, as long as that database has a JDBC driver (for Java) or has been set up as an ODBC data source on the computer running Corda Server (for COM environments).

For JDBC data sources, be sure that the driver is included in the classpath or header for the application.

Parameters

 

The setTypedDBQuery method accepts the following parameters:

 

 

objName

String

 

 

Specifies the name of the graph to which this data is applied.

 

 

driver

String

 

 

In Java, this is the JDBC driver name. Make sure this driver has been included in the classpath for the Web application.

For .NET, this parameter is not used and should be set to an empty String.

 

 

database

String

 

 

In Java, this is the database URL (e.g., jdbc:obdc:bcdemo).

For ASP/ASP.NET, this is the DSN name of the ODBC database that you want to connect to. setTypedDBQuery also supports a global.asa file or a DSN-less connection. For more information, see DSN-less Connections and Connecting to Queries Specified in a global.asa File.

 

 

user

String

 

 

A valid user name for the database. If no user name is required, set this parameter to an empty String.

 

 

password

String

 

 

The user password. If no password is required, set this parameter to an empty String.

 

 

query

String

 

 

The SQL query that you want to make. This query must return the data in the column format specified by dataType.

 

 

dataType

String

 

 

Specifies how data is organized in the data set. Supported values for this parameter are listed in Supported DataType Values.

 

void

 

setTypedResultSet

Available only for the Java Corda Embedder.

Syntax

 

myImage.setTypedResultSet(objName, resultSet, dataType);

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Imports the data from a ResultSet object into the specified graph object. The new data replaces any existing data. setTypedResultSet makes it much easier to ensure that data from a database query is in the correct format for consumption by the specified graph.

This method also lets you access meta-data that has been specified for each data point using the  %_CNAME meta tag. For more information, see META Tags.

Note: This command is for graph objects only.

For more information about using databases with Corda Server, see Importing Data Directly.

Parameters

 

The setTypedResultSet method accepts the following parameters:

 

 

objName

String

 

 

Specifies the name of the graph to which this data is applied.

 

 

resultSet

ResultSet

 

 

A resultSet is a ResultSet class in Java (java.sql package), or a ADBO.Recordset class in C#. ResultSet objects are usually returned when you make an SQL query.

 

 

dataType

String

 

 

Specifies how data is organized in the data set. Supported values for this parameter are listed in Supported DataType Values.

 

boolean

 

useCache

Syntax

 

myImage.useCache = true|false;

Alternate Syntax

 

ASP (VBScript) | Java Tag Library | PERL | PHP

Description

 

 

Specifies whether the generated Corda image is cached.

This command has two effects. First, it tells the client's Web browser whether or not to cache the image. Second, if you are running Corda 7 Enterprise with caching enabled, it tells Corda Server whether to cache the image.

By default, this value is set to true.

For more information, see Caching in the Corda 7 Install and Administration manual.