Name
pdf.GetBrush -- get PDF page as vector brush
Synopsis
[id, t] = pdf.GetBrush(id, page, brid[, transparent, getlinks])
Function
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:

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

#PDFACTION_GOTO:
Skip to page in current document.
#PDFACTION_REMOTEGOTO:
Skip to page in another document.
#PDFACTION_URI:
Open an URI.
#PDFACTION_LAUNCH:
Launch a program.
#PDFACTION_UNSUPPORTED:
Unknown action.

Target:
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:
Left edge of the link's bounding rectangle.

Top:
Top edge of the link's bounding rectangle.

Right:
Right edge of the link's bounding rectangle.

Bottom:
Bottom edge of the link's bounding rectangle.

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

Show TOC