Skip to content

Book

The Custom PDF is a type in-game Spawnable Object that renders a PDF from a URL. It has its own class, Book, with functions/members associated with it. This allows you to manipulate the special properties of a Custom PDF.

Example Usage: obj.Book.setPage(1, false)

Member Variables

Like Object member variables, Books have their own member variables.

Variable Description Type
page_offset The page numbers displayed in the Custom PDF UI are offset by this amount.

Info

For example, if page_offset were set to 10, the first page in the UI would be 11, rather than 1. Negative numbers are accepted, and useful if a rule book contains a front cover, index etc. within the PDF file.

Function Summary

Object Functions

Function Name Description Return  
getPage( offsetPageNumbering) Gets the current page of the PDF.
setPage( page,  offsetPageNumbering) Set current page.
setHighlight( x1,  y1,  x2,  y2) Set highlight box on current page.
clearHighlight() Clears the current highlight.

Function Details

getPage(...)

 Gets the current page of the PDF.

getPage(offsetPageNumbering)

  • offsetPageNumbering: Indicates whether or not page_offset should be applied to the page number returned.
    • Optional, defaults to `false`.

setPage(...)

 Sets the current page of the PDF. Returns true if the page was succesfully set, false if the page number was invalid.

setPage(page, offsetPageNumbering)

  • page: The new page number.
  • offsetPageNumbering: Indicates whether or not page_offset should be applied to the page number set.
    • Optional, defaults to `false`.

setHighlight(...)

 Draws a highlight rectangle on the popout mode of the PDF at the given coordinates. Coordinates (0,0) are the lower left corner of the PDF, while coordinates (1,1) are the upper right corner.

setHighlight(x1, y1, x2, y2)

  • x1: x coordinate of the rectangle's left side.
  • y1: y coordinate of the rectangle's bottom side.
  • x2: x coordinate of the rectangle's right side.
  • y2: y coordinate of the rectangle's top side.
-- Sets highlight of upper right quarter of the pdf
self.Book.setHighlight(0.5, 0.5, 1, 1)

Bug

setHighlight() will do nothing if you try to draw a highlight twice in a row at the same coordinates, even if you call clearHighlight() or reload() on the object in between calls to setHighlight().