Options
All
  • Public
  • Public/Protected
  • All
Menu

A Resource containing HTML data in plain text

Hierarchy

Index

Constructors

constructor

  • new HTMLResource(htmlstring: string, landscape?: boolean): HTMLResource
  • Parameters

    • htmlstring: string

      HTML input in plain text

    • landscape: boolean = false

      Whether or not the HTML should be rendered as landscape-oriented page. Defaults to false.

    Returns HTMLResource

Properties

data

data: string | Buffer

filetype

filetype: string

landscape

landscape: boolean

Methods

mimetype

  • mimetype(): string

orientation

  • orientation(): undefined | string
  • Either undefined or 'landscape', as is passed in the JSON.

    If 'landscape', the HTML is rendered as landscape-oriented page. Orientation is not supported for prepend/append sources, only for template resources.

    Returns undefined | string

    orientation

secondaryFileDict

  • secondaryFileDict(): { file_content: string; file_source: string; mime_type: string }
  • This Resource object as a dict object for use as a secondary file (prepend, append, insert,as subtemplate)

    Returns { file_content: string; file_source: string; mime_type: string }

    this Resource object as a dict object for use as a secondary file (prepend, append, insert, as subtemplate)

    • file_content: string
    • file_source: string
    • mime_type: string

templateDict

  • templateDict(): {}
  • This Resource object as a dict object for use as a template

    Returns {}

    dict representation of this resource as a template

    • [key: string]: string

Static fromBase64

  • Create a Base64Resource from a base64 string and a file type (extension)

    Parameters

    • base64string: string

      base64 encoded representation of a file

    • filetype: string

      file type (extension)

    Returns Base64Resource

    the created Resource

Static fromHtml

  • fromHtml(htmlstring: string, landscape?: boolean): HTMLResource
  • Create an HTMLResource with html data in plain text. Landscape is not supported for prepend/append sources, only for template resources.

    Parameters

    • htmlstring: string

      html content

    • landscape: boolean = false

      Whether or not the orientation needs to be landscape. Defaults to false.

    Returns HTMLResource

    the created Resource

Static fromLocalFile

  • Create a Base64Resource with the contents of a local file. The filetype is determined by the extension of the file.

    Parameters

    • localPath: string

      path to local file

    Returns Base64Resource

    the created Resource

Static fromRaw

  • fromRaw(rawData: Buffer, filetype: string): RawResource
  • Create a RawResource from raw file data and a file type (extension)

    Parameters

    • rawData: Buffer

      raw data as a Buffer object

    • filetype: string

      file type (extension)

    Returns RawResource

    the created Resource

Static fromServerPath

  • Create a ServerPathResource targeting a file on the server. The filetype is determined by the extension of the file.

    Parameters

    • serverPath: string

      location of target file on the server

    Returns ServerPathResource

    the created Resource

Static fromUrl

  • Create a URLResource targeting the file at url with given filetype (extension).

    Parameters

    • url: string

      file url

    • filetype: string

      file type (extension)

    Returns URLResource

    the created Resource

Generated using TypeDoc