Story

mutool only

new Story(contents, userCSS, em, archive)

Constructor method.

Create a new story with the given contents, formatted according to the provided userCSS and em size, and an archive to lookup images, etc.

Arguments:
  • contentsString HTML source code. If omitted, a basic minimum is generated.

  • userCSSString CSS source code. If provided, must contain valid CSS specifications.

  • emFloat The default text font size.

  • archive – An Archive from which to load resources for rendering. Currently supported resource types are images and text fonts. If omitted, the Story will not try to look up any such data and may thus produce incomplete output.

EXAMPLE

var story = new mupdf.Story(<contents>, <css>, <em>, <archive>);

Instance methods

document()

Return an XML for an unplaced story. This allows adding content before placing the Story.

Returns:

XML.

EXAMPLE

var xml = story.document();
place(rect)

Place (or continue placing) a Story into the supplied rectangle, returning a Placement Result Object. Call draw() to draw the placed content before calling place() again to continue placing remaining content.

Arguments:
Returns:

Placement Result Object.

EXAMPLE

var result = story.place([0,0,100,100]);
draw(device, transform)

Draw the placed Story to the given device with the given transform.

Arguments:
  • deviceDevice.

  • transform[a,b,c,d,e,f]. The transform matrix.

EXAMPLE

story.draw(device, mupdf.Matrix.identity);