Chapter 1. Static functions common for GUI and command line
Annotation createAnnotation(double[4] rect,string type);
Creates and initializes new annotation of given type. Parameter rect specifies annotation rectangle in default user space units.
Creates and returns new IProperty of type Array - empty array
IProperty createBool(bool value)
Creates and returns new IProperty of type Bool
PdfOperator createCompositeOperator(string beginText,string endText)
Creates new composite PDF Operator with specified starting and ending operator text
Creates and returns new IProperty of type Dict - empty dictionary
PdfOperator createEmptyOperator()
Creates new empty (NULL) PDF Operator
IProperty createInt(int value)
Creates and returns new IProperty of type Int
IPropertyArray createIPropertyArray()
Creates new array of IProperty items. This array can be used for example as operator parameters
IProperty createName(string value)
Creates and returns new IProperty of type String
PdfOperator createOperator(string text,IPropertyArray parameters)
Creates new PDF Operator with specified operator text and parameters
PdfOperatorStack createPdfOperatorStack()
Create new empty PDF Operator stack
IProperty createReal(double value)
Creates and returns new IProperty of type Real
IProperty createRef(int valueNum,int valueGen)
Creates and returns new IProperty of type Ref. Does not check validity of the values (if the reference target exists, etc ...)
IProperty createString(string value)
Creates and returns new IProperty of type String
bool delinearize(string inFile,string outFile)
Tries to delinearize PDF, reading from input file and writing delinearized result to output file. Does not check for overwriting output. Returnis true if delinearization was successful, false in case of failure. In case of failure the error mesage is available via error() function.
Returns last error message (localized) from some operations (openFile, save, saveRevision, saveCopy, delinearize)
bool exists(string chkFileName)
Returns true if given file exists on disk, false otherwise
string[] functions(bool includeSignatures)
Debugging function usable by script developers. Returns list of all functions that are present in current script interpreter. Functions are sorted alphabetically. If includeSignatures is set, function signatures are returned, otherwise only names
Pdf loadPdf(string name,bool advancedMode)
Loads a PDF file without replacing currently opened file in GUI. Scripts can manipulate the PDF file as necessary, but should close it with unloadPdf() method after it don't need to use it anymore. If advancedMode is set to true, document is opened in "advanced mode" (more advanced, but also more dangerous changes to it are possible)
Debugging function usable by script developers. Returns list of all objects that are in current script interpreter
Outputs given string to command window, followed by newline. Useful to output various debugging or status messages
void run(string scriptName,bool skipScriptPath)
Loads and runs script from given filename. File is looked for in the script path, unless absolute filename is given or parameter skipScriptPath is specified. If the file is not found in script path, it is searched in current directory.
void setDebugLevel(string param)
Sets new debugging verbosity level. Accepts same parameter as -d option on commandline (either number or symbolic constant).
string tr(string text,string context)
Translates given text to current locale. Optional parameter context can specify context of localized text. Returns translated text.
You can call this to explicitly request the tree to reload after the script finishes execution.
Debugging function usable by script developers. Returns sorted list of all variables that are in current script interpreter.
Returns version of editor (in format 'major.minor.release')
Chapter 2. Static functions in GUI
Table of Contents
void processEvents()
void setItemText(string name,string newText)
string getItemText(string name)
void about()
void addAnnotation(Page page,double x1,double y1,double w,double h)
void addObjectDialog(IProperty container)
void checkItem(string name,bool check)
void clearConsole()
void closeAll()
bool closeFile(bool askSave,bool onlyAsk)
void createMenuItem(string parentName,string name,string caption,string action,string accel,string icon,string[] classes=QStringList())
void createNewWindow()
void enableItem(string name,bool enable)
string filename()
string fileOpenDialog()
string fileSaveDialog(string oldName)
Color getColor(string colorName);
string getEditText(string textName)
double getNumber(string name)
void help(string topic)
bool isVisible(string widgetName)
void message(string msg)
Variant mergeDialog()
bool modified()
bool openFile(string name)
void openFileNew(string name)
void options()
Page page()
int pageNumber()
Color pickColor();
Menu popupMenu(string menuName)
bool question(string msg)
int question_ync(string msg)
void restoreWindowState()
bool save()
bool saveCopy(string name)
bool saveRevision()
void saveWindowState()
void setColor(string colorName,Variant newColor)
void setEditText(string textName,string newText)
void setNumber(string name,double number)
void setPredefs(string name,string predefs)
void setPredefs(string name,string[] predefs)
void setRevision(int revision)
void setVisible(string widgetName, bool visible)
void showItem(string name,bool show)
TreeItem treeRoot()
TreeItem treeRootMain()
void warn(string str)
TreeItem firstSelectedItem(string name)
TreeItem nextSelectedItem()
CObject firstSelected(string name)
CObject nextSelected()
QProgressBar * progressBar()
Allow application to process its events, so the gui can redraw itself. Useful, it it is called periodically while doing some lenthy operation
void setItemText(string name,string newText)
Set text of all menu and toolbar items with given name to specified string. The string will be transtated according to the translation file, so it is suggested to supply english text and add corresponding localized translation into the localization file.
string getItemText(string name)
Get text of menu or toolbar item with given name. Returns untranslated (english) string, even when the application is run using another language translation. When setting back the same string, it will be re-translated according to translation file, if different GUI language is selected
Invokes "About" dialog, showing information about this program and its authors
void addAnnotation(Page page,double x1,double y1,double w,double h)
Creates dialog for annotations creation. Parameter page is page in which the annotation will be added (x1,y1) are coordinated of lower left point of annotation rectangle. W is the rectangle widht and h is its height Returns after annotation have been inserted into page, or dialog have been cancelled
void addObjectDialog(IProperty container)
Invokes dialog for adding additional objects to specified container (which must be
Dictionary or
Array). After invoking dialog, this function returns immediately and the dialog is left for the user to use. If given object is not specified, curently selected object in property editor is used. If the object is not
Dictionary or
Array, no dialog is shown.
void checkItem(string name,bool check)
Check (second parameter is true) or uncheck (false) item in toolbar and/or menu, given its name If you prefix name with slash ("/"), you will affect "class" of items - every item that belong to the specified class
Note
Toolbuttons will automatically convert to Togglable toolbuttons this way and will start togling itself automatically on each succesive click
Clear the console output window
Closes all windows (and thus ends application)
bool closeFile(bool askSave,bool onlyAsk)
Closes file opened in this editor window. if askSave is true, user is asked to save the file if it is modified. if onlyAsk is true, file is not actually closed, only user is asked if he want to save work (if not specified, defaults to false). returns true in case of success, or false if user decide not to close current document and keep it open.
void createMenuItem(string parentName,string name,string caption,string action,string accel,string icon,string[] classes=QStringList())
Load one menu or toolbar item and insert it into parent menu or toolbar. If the name is "" or "-", separator is inserted on place of the item and rest of parameters are ignored. If inserting item into toolbar and the name will match one of the special items, the special item will be inserted in toolbar and rest of the parameters are ignored. Items that are loaded from settings have theyir name equal to the key in setting they are stored under.
Creates new editor window with empty document in it.
void enableItem(string name,bool enable)
Enable (second parameter is true) or disable (false) item in toolbar and/or menu, given its name If you prefix name with slash ("/"), you will enable or disable "class" of items - every item that belong to the specified class
Return name of file loaded in editor window. If the file does not exist on disk (not loaded any file, or file was never saved, having no name), empty string is returned.
Invokes "open file" dialog and return selected filename, or NULL if dialog was cancelled
string fileSaveDialog(string oldName)
Invokes "save file" dialog and return selected filename, or NULL if dialog was cancelled. If file selected in dialog already exists, user is asked to confirm overwriting before returing its name.
Color getColor(string colorName);
Get color from color picker with given name. Returns false if the color picker does not exist.
string getEditText(string textName)
Get text from editbox or text selection box in toolbar with given name. Returns false if the box does not exist.
double getNumber(string name)
Get number from number editbox in toolbar with given name. Returns 0 if the number editbox does not exist.
Invokes program help. Optional parameter is topic - if invalid or not defined, help title page will be invoked
bool isVisible(string widgetName)
Check if part of the window is visible (returns true) or hidden (returns false) widgetName specifies which part:
Show simple messagebox with specified message and wait until user dismiss it
Bring up "merge pages from another PDF in this document" dialog. Returns result of merge or NULL if dialog was cancelled Result is array of three elements:
First element is array with page numbers
Second element is array with page positions
Third is filename of the document to be merged in
Return true if the document was modified since it was opened or last saved, false otherwise.
bool openFile(string name)
Opens file with given name in this editor window. Opens without any questions, does not ask user to save changes to current file, etc ... Return true on success, false on failure to load file.
void openFileNew(string name)
Opens file with given name in new editor window
Invokes options dialog. Does not wait for dialog to be closed by user and return immediately.
Return currently shown page
Return page number of currently shown page
Invoke dialog to select color and return the color that user have picked, or false if user cancelled the dialog.
Menu popupMenu(string menuName)
Create and return a
Menu object. The menuName parameter specifies name of item or list from configuration, that will be used to initially fill the menu with items. If this parameter is not specified or invalid, the menu will be initially empty. See documentation for
Menu object type for more info about using popup menus.
bool question(string msg)
Show Yes/No question and wait for answer. Return true if user selected "yes", or false if user selected "no"
int question_ync(string msg)
Show Yes/No/Cancel question and wait for answer. Return 1 if user selected "yes", 0 if user selected "no", -1 if user cancelled dialog (selecting Cancel)
void restoreWindowState()
Restore state of current editor window (size and position of window and elements inside it) State is restored from state saved in editor's configuration file.
Save currently edited document. If current document have no name, user will be asked for name. If it is not possible to ask user or user presses cancel in file chooser, document is not saved. Return true if document was saved, false if it was not saved for any reason (file write error, user refused to give filename on new file ...)
bool saveCopy(string name)
Save currently edited document (with currently active revision) under different name. Return true if document was saved, false if it failed to save for any reason
Save currently edited document, while creating new revision in the process. Return true if document was saved, false if it was not saved for any reason.
Save state of current editor window (size and position of window and elements inside it) State is saved to editor's configuration file.
void setColor(string colorName,Variant newColor)
Set color of color picker with given name
void setEditText(string textName,string newText)
Set text in toolbar editbox with given name or set selection in text selection box. If you specify string that is not one of the items in the selection box, the current item will remain selected.
void setNumber(string name,double number)
Set number in toolbar number editbox with given name
void setPredefs(string name,string predefs)
Set list of predefined values for number edit box or select text box with given name. The values in the list must be separated by commas. For number edit box, the user is still able to type in any value not in the list.
void setPredefs(string name,string[] predefs)
Set list of predefined values for number edit box or select text box with given name. For number edit box, the user is still able to type in any value not in the list.
void setRevision(int revision)
Change active revision in current PDF document
void setVisible(string widgetName, bool visible)
Set part of the window to be either visible or invisible, widgetName specifies which part, see isVisible for list of possible names.
void showItem(string name,bool show)
Show (second parameter is true) or hide (false) item in toolbar, given its name If you prefix name with slash ("/"), you will affect "class" of items - every item that belong to the specified class
Return root item of currently selected tree