Script Reference : Extensions

Extension is an extended version of script. In additional to text of script itself it has images for buttons, information about commands and so on.
Extension is a ZIP file with ZIP extension. It should contains script itself, information file, commands, ribbon and images for buttons.

Zip file

zip file must be compressed with deflate algorithm, no encryption, no LZMA.

code.psf psf Script file, same as regular priPrinter script. Required.
info.txt txt Information about extension. Name, file name, copyright, version, etc. Required.
buttons.txt txt Description of commands implemented by this plugins
r_crop.txt, r_page.txt, r_pdf.txt, etc txt Location of buttons in priPrinter ribbon. Each file for separate tab.

 

info.txt

Extension information file.

filename:"printerbtn"
id:{E2BAF4B6-E49F-427C-A2CB-881E05464ED6}
copyright:Pelikan Software Kft.
version:1.0.0
info:Creates 'Print Now' button in the page tab
name:Print Now Button

Where

filename Name of extension on user computer
id Unique identifier of extension in string format. It does not have to be a GUID.
copyright How it will be displayed in Extension Manager
version version in X.X.X format
info Description of extension
name Short name of extension

code.psf

It's a regular priPrinter script file. It just have to define special functions for handling buttons and configuration dialog.

OnClick() Handle click on button.
OnConfig(cmd) Show configuration dialog. This function may be called from Extension Manager.
OnStart() The OnStart function is called by priPrinter when priPrinter started.
OnClose() priPrinter calls this function as a signal that an application is to terminate.
OnLoad() Called after loading new document
OnPrinterChanged() Called after selecting another printer

OnClick

function OnClick(cmd)
{
  window.DoCommand("ribbon.print");
  return true;	
};

This extension hanles only one command, so there is no need to check for it's name. This particular extension just executes another standard command.

OnConfig, OnLoad, OnPrinterChanged

function OnConfig()
{
  local dlg=Dialog ();
  ...
  local rezult=dlg.Execute();
  if(rezult)
  {
   ...
  }
}

function OnLoad()
{
   MsgBox("OnLoad");
}

function OnPrinterChanged()
{
   MsgBox("OnPrinterChanged");
}

buttons.txt

File with definition of commands provided by this extension.


imglib "ext_printer_16" { w=16 h=16 resource="print_16.apm" }
imglib "ext_printer_20" { w=20 h=20 resource="print_20.apm" }
imglib "ext_printer_32" { w=32 h=32 resource="print_32.apm" }
imglib "ext_printer_48" { w=48 h=48 resource="print_48.apm" }
category "printbtn"{
cmd "Print" { text="513|Print" img{lib="ext_printer_16" id=0} img{lib="ext_printer_20" id=0} img{lib="ext_printer_32" id=0} img{lib="ext_printer_48" id=0}hint="221|Print now"}
}

Where imglib - image library

 

More information will be available shortly.