new Pdf(parent, propsopt)
PDF viewer component rendered through the browser's native PDF support.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
parent | HTMLElement | HTML element that is going to be the parent of the component. | |
props | TComponents. | <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
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.
- Overrides
Returns:
Default properties.
- Type:
- TComponents.
PdfProps
markup() → {string}
Returns the HTML markup for the tab component.
- Overrides
Returns:
The HTML markup
- Type:
- string
onDestroy() → {void}
Operations performed during component destruction
- Overrides
Returns:
- Type:
- void
(async) onRender() → {Promise.<void>}
Renders the pdf component, applying styles and attaching event listeners.
- Overrides
Returns:
- Type:
- Promise.<void>
(static) loadCssClassFromString(css) → {void}
Add css properties to the component
Parameters:
| Name | Type | Description |
|---|---|---|
css | string | 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;
}
}`);