Script Reference : Document

A Document object representing printer Job.

Data Members
Name Type Description
jobname string Job Name.
numcopies int Number of copies. How it was specified by print application. Read only.
numpages int Number of pages. Read Only.
filename string File name. Read only.
user string The name of the user who printed this job. Read only.
machine string Name of the machine that created this job. Read only.
app string Name of the application that created this job. Read only.
printer string Name of priPrinter printer. Read only.
filesize int Specifies the size, in bytes, of the document. Read only.
time Date A Date object that specifies the time that this document was printed.

 

Constructors
Type Description
  Please use window or layout methods in order to access root document.

 

Methods
Name Return Type Description
int GetNumSubDocs() int Gets the number of sub documents in this document. Only root document may have sub documents.
Document GetSubDoc(int) Document Returns the specified document in this document.
bool DeleteSubDoc(int/Document ) bool Method removes sub document from this document.
bool InsertSubDoc(Document [,int index]) bool Inserts removed document to custom position. Use index -1 in order to insert document to the end.
int GetNumPages() int Gets the number of pages in document.
Page GetPage(int) Page Returns the specified page in this document.
Page DuplicatePage(int/Page) Page Method duplicates page and inserts it after source page. Source page can be specified by index or page object.
bool MovePage(int/Page,int newPos) bool Move page to a new position
Page InsertPage(Page[,int index]) Page Inserts existing or removed page, to custom position. Use index -1 in order to insert page to the end.
Page InsertBlank(Page[,int index]) Page Inserts blank page to custom position. Use index -1 in order to insert page to the end. parameter Page is used as template for blank page.
bool DeletePage(int index/Page) bool Method deletes page from this document.
int IndexOf(Page) int Method returns index of page in the document.
     
bool SaveAs(string) bool Method saves this document to priPrinter file.

 

Sample 1.

local doc=window.GetDocument();
local sub=doc.GetNumSubDocs();
if(sub)
{
	local d=doc.GetSubDoc(sub-1);// last one
	print("user: "+d.user+"\n");
	print("machine: "+d.machine+"\n");
	print("printer: "+d.printer+"\n");
	print("job: "+d.jobname+"\n");
	print("file: "+d.filename+"\n");
	print("size: "+d.filesize+"\n");
}

How to retrieve number of copies.

local doc=window.GetDocument();
if(doc && doc.GetNumSubDocs())
  {
   local d=doc.GetSubDoc(0);
   MsgBox("NumCopeis :" +d.numcopies);
  }