pdf.GetBrush -- get PDF page as vector brush
[id, t] = pdf.GetBrush(id, page, brid[, transparent, getlinks])
This function can be used to convert a page from the PDF document specified by id to a vector brush using the identifier brid. If you pass Nil in brid, pdf.GetBrush() will automatically choose a vacant identifier and return it.

The page to convert must be specified in the page argument. It must be a number in the range of 1 to the total number of pages in the document. The PDF document specified by id must have been opened using pdf.OpenDocument().

The optional parameter transparent allows you to specify whether you'd like the page background to be transparent or white. If you pass True here, you'll get a vector brush in which the page background is completely transparent by using alpha channel transparency. Otherwise the page background will be white and your vector brush won't use any transparency.

Note that the vector brush will still depend on the PDF document so it is not allowed to call pdf.CloseDocument() on the document while you still need the brush.

Also note that you should only use this function for pages that haven't been loaded with pdf.LoadPage() before. If you want to convert a page that has been loaded using pdf.LoadPage() to a brush, use the pdf.GetBrushFromPage() function instead. See pdf.GetBrushFromPage for details.

Starting with Polybios 1.1, there is an optional argument called getlinks. If this is set to True, pdf.GetBrush() will return a table containing all links in the page. The table is returned as the second return value if getlinks is set to True. For each entry, the table will have the following fields initialized:

This field specifies what should happen if the respective link is clicked. This will be set to one of the following special constants:

Skip to page in current document.
Skip to page in another document.
Open an URI.
Launch a program.
Unknown action.

This will be set to the link's target. Depending on Action, this may be set to a page number, a URI, or the path to an external file.

Left edge of the link's bounding rectangle.

Top edge of the link's bounding rectangle.

Right edge of the link's bounding rectangle.

Bottom edge of the link's bounding rectangle.

identifier of the PDF document to use
page number to convert (starting from 1)
identifier for the vector brush or Nil for auto id selection
optional: True for a transparent page background, False for a white page background
optional: True if page links should be returned (see above) (defaults to False) (V1.1)
optional: identifier of the brush; will only be returned when you pass Nil as argument 3 (see above)
optional: table containing all page links (see above) (V1.1)

Show TOC