Report methods

breakPage

mail

Report

divide

open

save

indent

outdent

writeText

breakPage

5.0

 

 

X 

Ends the current page and begins a new one.

divide

5.0

 

 

X 

Writes a horizontal rule across the page at the current location with the given width. The rule goes from the current indent level to the rightmost edge of the bounding box. If the indent level is past the middle of the bounding box, the rule shows this.

Parameters

nWidth 

(optional) The horizontal rule width to use.

indent

5.0

 

 

X 

Increments the current indentation mark by nPoints or the default amount. If a report is indented past the middle of the page, the effective indent is set to the middle. Note that divide makes a mark to indicate whether it has been indented too far.

See writeText for an example of usage.

Parameters

nPoints 

(optional) The number of points to increment the indentation mark.

mail

5.0

 

 

X 

Ends report generation and mails the report.

See also mailGetAddrs, app.mailMsg, the Doc mailForm method, and the FDF object mail method.

Parameters

bUI 

(optional) Specifies whether to display a user interface. If true (the default), the rest of the parameters are used to seed the compose-new-message window that is displayed to the user. If false, the cTo parameter is required and all others are optional.

Note:(Acrobat 7.0) When this method is executed in a non-privileged context, the bUI parameter is not honored and defaults to true. See Privileged versus non-privileged context.

cTo 

(optional) A semicolon-separated list of recipients for the message.

cCc 

(optional) A semicolon-separated list of CC recipients for the message.

cBcc 

(optional) A semicolon-separated list of BCC recipients for the message.

cSubject 

(optional) The subject of the message. The length limit is 64 KB.

cMsg 

(optional) The content of the message. The length limit is 64 KB.

open

5.0

 

 

X 

Ends report generation, opens the report in Acrobat and returns a Doc that can be used to perform additional processing of the report.

Parameters

cTitle 

The report title.

Returns

A Doc.

Example

Open a report, get the Doc, and set some properties of the document.

   var docRep = rep.open("myreport.pdf");

   docRep.info.Title = "End of the month report: August 2000";

   docRep.info.Subject = "Summary of comments at the August meeting";

See writeText for a more complete example.

outdent

5.0

 

 

X 

The opposite of indent; that is, decrements the current indentation mark by nPoints or the default amount.

See writeText for an example of usage.

Parameters

nPoints 

(optional) The number of points to decrement the indentation mark.

Report

5.0

 

 

X

A constructor. Creates a new Report object with the given media and bounding boxes (values are defined in points or 1/72 of an inch). Defaults to a 8.5 x 11 inch media box and a bounding box that is indented 0.5 inches on all sides from the media box.

Parameters

aMedia 

(optional) The media type.

aBBox 

(optional) The bounding box size.

Returns

A Report object.

save

5.0

 

S 

X 

Ends report generation and saves the report to the specified path.

Note:This method can only be executed during a batch or console event. See Privileged versus non-privileged context for details. The event object contains a discussion of JavaScript events.

Parameters

cDIPath 

The device-independent path.

cFS 

(optional) The file system. The only value for cFS is “CHTTP”. In this case, the cDIPath parameter should be an URL. This parameter is only relevant if the web server supports WebDAV.

Example 1

   rep.save("/c/myReports/myreport.pdf");

Example 2

   rep.save({

      cDIPath: "http://www.example.com/reports/WebDAV/myreport.pdf",
      cFS:"CHTTP"}

   );

writeText

5.0

 

 

X 

Writes out a block of text to the report. Every call begins on a new line at the current indentation mark. Correctly wraps Roman, CJK, and WGL4 text.

Parameters

String 

The block of text to use.

Example

   // Get the comments in this document, and sort by author

   this.syncAnnotScan();

   annots = this.getAnnots({nSortBy: ANSB_Author});

   

   // Open a new report

   var rep = new Report();

   

   rep.size = 1.2;

   rep.color = color.blue;

 

    if (annots) {

      rep.writeText("Summary of Comments: By Author");

      rep.color = color.black;

      rep.writeText(" ");

      rep.writeText("Number of Comments: " + annots.length);

      rep.writeText(" ");

   

      var msg = "\200 page %s: \"%s\"";

      var theAuthor = annots[0].author;

      rep.writeText(theAuthor);

      rep.indent(20);

      for (var i=0; i < annots.length; i++) {

         if (theAuthor != annots[i].author) {

            theAuthor = annots[i].author;

            rep.writeText(" ");

            rep.outdent(20);

            rep.writeText(theAuthor);

            rep.indent(20);

         }

         rep.writeText(

            util.printf(msg, 1 + annots[i].page, annots[i].contents));

      }

   } else {

      var msg = "No annotations found in this document, %s.";

      rep.writeText(util.printf(msg, this.documentFileName));

   }

   // Now open the report

   var docRep = rep.open("myreport.pdf");

   docRep.info.Title = "End of the month report: August 2006";

   docRep.info.Subject = "Summary of comments at the August meeting";