PStill Script Reference 1.90 covered http://www.pstill.com 1. Introduction PStill allows to modify the output by the means of scripts. A script is loaded by the option -M pagecontrol=/path/to/script.sl and written in S-Lang (www.s-lang.org) 2. Callbacks To modify the output PStill uses several callback functions. If the script defines one or more of those functions they are called during the conversion. ps_do_init() is called during initalisation. Put any setup commands here (e.g. setting the Title, Auther etc. meta fields) ps_do_showpage(pagenum) is called during the interpretation phase. The current page number is supplied to this function. Any kind of drawings can be done in this function. pdf_page_setup(pagenum) is called in the PDF backend, for each page. The current page number is supplied to this function. Page size changes, page shifts, rotates, translates and setup of PDF-Boxes can be done in this function. interceptFill() interceptEOFill() interceptStroke() interceptImage() are 'intercept' functions. These functions are called whenever a respective interpreter function is called and can determine if the operation is taken over to the output. When a such function calls suppressOutput(); its output is suppressed. 1. Functions int pageWidth() int pageHeight() To be used in the pdf_page_setup function. return the page size of the job. Use int pageWidthHiRes() int pageHeightHiRes() for float values. setupPage(float shift_x,float shift_y,float rotate_angle, float scalefactor_x,float scalefactor_y,int keepOnSamePage); To be used in the pdf_page_setup function. This function performs a transfrom of the current page. keepOnSamePage can either be 0 or 1. 0 means the page is generated normally, 1 means no 'new page' is generated and any subsequent operations are drawn on the same page. setMediaBox(int Width,int Height); To be used in the pdf_page_setup function. Sets the media box of the output. Use setHiResMediaBox(float Width,float Height); for float numbers. setCropBox(float x0, float y0, float x1, float y1); setTrimBox(float x0, float y0, float x1, float y1); setBleedBox(float x0, float y0, float x1, float y1); setArtBox(float x0, float y0, float x1, float y1); To be used in the pdf_page_setup function. Sets the other boxes of the output. setOutputPageOrder(string OrderStr); To be used in the pdf_page_setup function. Sets the order of output pages, e.g. a string "2,1,4,3" reorders the output in the respective way. makePoster(int outputsizex, int outputsizey, int tilesizex, int tilesizey, int border, float bleed) To be used in the pdf_page_setup function. primes the backend to cut a larger output page into smaller pages to generate a "poster" setInfoTitle(string Title); setInfoSubject(string Subject); setInfoCreator(string Creator); setInfoAuthor(string Author); setInfoKeywords(string Keywords); to be used in the ps_do_init function. Sets the respective meta information for the PDF output. startGFX(); to be used in the ps_do_showpage function. Must be called before any drawing can be done. endGFX(); to be used in the ps_do_showpage function. Must be called to close the drawing ops. Must be inited by a startGfx first! In between startGFX and endGFX drawing commands may be used: execPSCode(string PSCode); run any PS code defined here. setRGBColor (0.0, 0.0, 0.0); setCMYKColor (0.0, 0.0, 0.0, 0,0); setGrayColor (0.0); sets the color and colorspace. setFont(string Fontname, int encoding, float size_x, float size_y); sets the font, size and encoding: 0 is font default, 1 is ISOLatin1 drawText( string text, float x, float y, float rotate_angle); draws text at the give location. drawRect(x0,y0,w,h); draws a rectangle at the given location. execPDFFile(string pathToFile, int pagenum, float xpos, float ypos, float scale, float rotation_in_degrees); draws a PDF file at the given location. CWD is always the PStill program directory at this point. pagenum is the page extracted from the PDF (drawing can only be one page of the defined PDF). execEPSFile(string pathToFile, float xpos, float ypos, float scale, float rotation_in_degrees); draws a EPS file at the given location. CWD is always the PStill program directory at this point. This function also accepts EPS with preview (PS part is used) and plain TIFF (raster image is used). Special functions: int currentPDFPageNums() returns the number of pages in the source (PDF source only). setOverrideShowpage(int doOverride); allows to suppress the 'showpage' effect of erasing the page. 1 to override, 0 normal behaviour. Only allowed in the pst_do_showpage function. During init phase: execPSDirect(string code); execs PS code directly. This different to execPSCode as the code defined using execPSCode is collected and then executed by the showpage callback. This function directly feed the PS to the interpreter. string dscComment(1) returns the %%Title: info of the input. string dscComment(2) returns the %%Creator: info of the input. string dscComment(3) returns the %%CreationTime: info of the input. string dscComment(4) returns the %%For: info of the input. string dscComment(1000) returns the src path of the input Intercept support functions: float array currentGrayColor() returns the current gray color. float array currentRGBColor() returns the current RGB color. float array currentCMYKColor() returns the current CMYK color. float array currentFontMatrix() returns the current font matrix int currentColorspace() returns the current color space: GRAY == 1 RGB/HSB == 2 CMYK == 3 INDEXED == 4 SPOT == 5 PATTERN == 6 DEVICEN == 7 int currentOverprint() returns the current Overprint value. int currentPageNum() returns the current page number. string currentFontName() returns the current font name. float array currentPathBBox() returns the current path bounding box. setOverprint(int value); sets the overprint value. --------------------------------------------- See examples at http://www.wizards.de/~frank/WP/ControlScripts/