TComponents. Pdf

new Pdf(parent, propsopt)

PDF viewer component rendered through the browser's native PDF support.

Parameters:
NameTypeAttributesDescription
parentHTMLElement

HTML element that is going to be the parent of the component.

propsTComponents.PdfProps<optional>

The properties object.

Example
const pdf = new TComponents.Pdf(document.body, {
  position: 'absolute',
  width: 200,
  height: 200,
  zIndex: 1000,
  pdfSrc: 'xxxx',
});

// Render the component.
await pdf.render();

Extends

Members

pdfSrc :string

Set pdf source.

Type:
  • string
Example
const pdf = new TComponents.Pdf(document.body, {
  position: 'absolute',
  width: 200,
  height: 200,
  zIndex: 1000,
  pdfSrc: 'xxxx',
});

// Render the component.
await pdf.render();
 // Set pdf source
pdf.pdfSrc = 'xxxx';

Methods

(protected) defaultProps() → {TComponents.PdfProps}

Returns the default properties of the pdf component.

Returns:

Default properties.

Type: 
TComponents.PdfProps

markup() → {string}

Returns the HTML markup for the tab component.

Returns:

The HTML markup

Type: 
string

onDestroy() → {void}

Operations performed during component destruction

Returns:
Type: 
void

(async) onRender() → {Promise.<void>}

Renders the pdf component, applying styles and attaching event listeners.

Returns:
Type: 
Promise.<void>

(static) loadCssClassFromString(css) → {void}

Add css properties to the component

Parameters:
NameTypeDescription
cssstring

The css string to be loaded into style tag

Returns:
Type: 
void
Example
TComponents.Pdf.loadCssClassFromString(`
  .tc-pdf {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
  }
}`);