# Mnemonics

'RECTANGLE' | Draw a Rectangle

GUI Display/Printer

## Format

'RECTANGLE'(x,y,x,y[,radius[,attrib$]])

Where:

x,y,x,y | Coordinates for top left/bottom right corners, in graphical units.
radius | Positive integer representing the rounding factor for corners. A negative value will have its sign flipped. If the radius exceeds half the height (or width), the system assumes a semi-circle is used to round the edge.
attrib$ | Optional attribute string. The valid code is:
<URL> | (*PDF* Only) Changes the rectangle into a hyperlink. (added in PxPlus 2019) Where: URL is the destination of the hyperlink. See Hyperlinks. #### Note: This option requires the use of the Haru PDF library; therefore, the 'HP' system parameter must be set.

## Description

Use 'RECTANGLE' to draw (print) a rectangle defined by two sets of x,y coordinates. Use graphical units or @X(col) and @Y(line) functions for the coordinates. The 'RECTANGLE' mnemonic uses current attributes for the 'FILL' and 'PEN' mnemonics.

## Hyperlinks

Rectangle Hyperlinks

If using the LibHaru *PDF* interface, i.e. 'HP' is On, and you print to a *PDF* channel using 'RECTANGLE' with the <URL> attribute, the rectangle will become a hyperlink with URL as the destination. This can also be used to create an arbitrary region in the PDF that is a hyperlink. By setting 'PEN' to 0, the rectangle will not be drawn, but the hyperlink will be created.

PDF viewer applications will attempt to guess whether a URL is a Web link or a file link. To prevent the PDF viewer application from being incorrect, the recommendation is that you prefix Web links with http://, https:// or ftp:// and prefix file links with file:///.

If you are creating a file link and using the file:/// prefix, you must use an absolute path to the file. However, if you want to use a relative path to the file, do not use the file:/// prefix and instead just specify the relative path. For example, if the open PDF file is in the directory C:\myapp\reports and you want to link to another PDF file called abc.pdf located in C:\myapp\reports\2016, the URL must be specified as 2016\abc.pdf.

Example:

> open (pdf_chan)"*PDF*;file=C:\my_app\abc\report.pdf"
> print (pdf_chan)'pen'(1,3,8),'fill'(2,6)
> print (pdf_chan)'rectangle'(200,200,600,600,0,"<https://www.pvxplus.com>")
> print (pdf_chan)'pen'(0,0,0)
> print (pdf_chan)'rectangle'(800,100,900,400,0,"<file:///C:/my_app/abc/map.pdf>")
> close (pdf_chan)

(Support for rectangle hyperlinks in PDFs if using LibHaru was added in PxPlus 2019.)

## Example

print 'pen'(1,3,8),'fill'(2,6)
print 'rectangle'(100,100,400,600)
print 'rectangle'(700,100,820,220,30)