@mescius/dspdfviewer
Version:
Document Solutions PDF Viewer
269 lines (268 loc) • 9.26 kB
TypeScript
import { SharedAccessMode } from "../SharedDocuments/types";
/**
* Represents the structure of extracted table data, including rows, columns, and individual cell details.
*
* @typedef {Object} ExtractedTableData
* @property {ExtractedRow[]} rows - An array representing the rows in the table.
* Each row has a `length` property indicating its height or spacing.
* @property {ExtractedColumn[]} cols - An array representing the columns in the table.
* Each column has a `length` property indicating its width.
* @property {ExtractedCell[]} cells - An array of extracted table cells.
* Each cell contains information about its position, spanning properties, and text content.
*/
export declare class TableDefClientModel {
/**
* The table bounds on a page.
* @type {Rectangle}
*/
bounds: TableDefRectangleClientModel;
/**
* The list of table columns.
* @type {TableVectorDefClientModel[]}
*/
cols: TableVectorDefClientModel[];
/**
* The list of table rows.
* @type {TableVectorDefClientModel[]}
*/
rows: TableVectorDefClientModel[];
/**
* The list of table cells.
* @type {TableCellDefClientModel[]}
*/
cells: TableCellDefClientModel[];
}
/**
* Represents a table vector definition (row or column).
*/
export declare class TableVectorDefClientModel {
/**
* The vector bounds on a page.
* @type {Rectangle}
*/
bounds: TableDefRectangleClientModel;
}
/**
* Represents a cell definition in a TableDefClientModel.
*/
export declare class TableCellDefClientModel {
/**
* The cell bounds on a page.
* @type {Rectangle}
*/
bounds: TableDefRectangleClientModel;
/**
* The 0-based index of the table row containing the current cell.
* @type {number}
*/
row: number;
/**
* The 0-based index of the table column containing the current cell.
* @type {number}
*/
col: number;
/**
* The number of rows spanned by the current cell.
* @type {number}
*/
spanRows: number;
/**
* The number of columns spanned by the current cell.
* @type {number}
*/
spanCols: number;
/**
* The cell text value.
*/
text: string;
}
/**
* Represents a rectangle with x, y, width, and height.
*/
export type TableDefRectangleClientModel = {
/**
* The x-coordinate of the rectangle's top-left corner.
* @type {number}
*/
x: number;
/**
* The y-coordinate of the rectangle's top-left corner.
* @type {number}
*/
y: number;
/**
* The width of the rectangle.
* @type {number}
*/
width: number;
/**
* The height of the rectangle.
* @type {number}
*/
height: number;
/**
* Origin for vertical position (bottom/left or top/left).
*/
origin?: "bottom" | "top";
};
/**
* Specifies the available formats for exporting table data.
*
* @typedef {("tsv" | "csv" | "json" | "xlsx" | "xml" | "html")} TableDataExportFormat
*
* @description
* The following formats are supported for exporting table data:
*
* - `"tsv"`: Export data as a TSV (Tab Separated Values) file. TSV files are similar to CSV files but use tabs as delimiters, making them suitable for data storage and exchange.
* - `"csv"`: Export data as a CSV (Comma Separated Values) file. CSV files are commonly used for data storage and are compatible with spreadsheet applications like Microsoft Excel and Google Sheets.
* - `"json"`: Export data as a JSON (JavaScript Object Notation) file. JSON is a lightweight, text-based format for data exchange, ideal for APIs and web services.
* - `"xlsx"`: Export data as an Excel spreadsheet file. This format is compatible with Microsoft Excel and other spreadsheet software, allowing for advanced formatting and data manipulation.
* - `"xml"`: Export data as an XML (Extensible Markup Language) file. XML is used for storing and transporting structured data, making it ideal for data exchange between systems.
* - `"html"`: Export data as an HTML (HyperText Markup Language) file. This format generates an HTML table, which can be easily viewed in any web browser and shared across the web.
*/
export type TableDataExportFormat = "tsv" | "csv" | "json" | "xlsx" | "xml" | "html";
/**
* Represents information about a document.
*/
export declare class DocumentInfo {
/**
* Gets or sets the title of the document.
*/
title: string;
/**
* Gets or sets the name of the application that created the original document.
*/
creator: string;
/**
* Gets or sets the name of the application that created the document.
*/
producer: string;
/**
* Gets or sets the name of the person that created the document.
*/
author: string;
/**
* Gets or sets the subject of the document.
*/
subject: string;
/**
* Gets or sets keywords (separated by comma) associated with the document.
*/
keywords: string;
/**
* Gets or sets the creation date and time of the document.
* The PDF Specification does not define a special type for DateTime values,
* such values are stored as strings in a special format, similar to (D:YYYYMMDDHHmmSSOHH'mm'),
* see the spec for details (PDF 1.7 chapter 3.8.3).
*/
creationDate?: string;
/**
* Gets or sets the date and time the document was most recently modified.
* The PDF Specification does not define a special type for DateTime values,
* such values are stored as strings in a special format, similar to (D:YYYYMMDDHHmmSSOHH'mm'),
* see the spec for details (PDF 1.7 chapter 3.8.3).
*/
modifyDate?: string;
}
/**
* Represents information about an opened document.
* @class
*/
export declare class OpenDocumentInfo {
/**
* The access mode of the opened document.
* @public
*/
accessMode: SharedAccessMode;
/**
* The unique identifier of the opened document.
* @public
*/
documentId: string;
/**
* The file name of the opened document.
* @public
*/
fileName: string;
/**
* The total number of pages in the opened document.
* @public
*/
pagesCount: number;
/**
* The default viewport size of the opened document.
* @public
*/
defaultViewPortSize: {
w: number;
h: number;
};
/**
* Additional information about the opened document.
* @public
*/
info: DocumentInfo;
/**
* Constructs a new instance of the OpenDocumentInfo class.
* @param {object} params - The parameters for initializing the OpenDocumentInfo.
* @param {SharedAccessMode} params.accessMode - The access mode of the opened document.
* @param {string} params.documentId - The unique identifier of the opened document.
* @param {string} params.fileName - The file name of the opened document.
* @param {number} params.pagesCount - The total number of pages in the opened document.
* @param {{ w: number, h: number }} params.defaultViewPortSize - The default viewport size of the opened document.
* @param {DocumentInfo} params.info - Additional information about the opened document.
*/
constructor(params: {
accessMode: SharedAccessMode;
documentId: string;
fileName: string;
pagesCount: number;
defaultViewPortSize: {
w: number;
h: number;
};
info: DocumentInfo;
});
}
/**
* Represents document modifications.
* @typedef {object} DocumentModification
* @property {boolean} [renderInteractiveForms] - Specifies whether to render interactive forms.
* @property {number} [rotation] - The rotation angle for the document.
* @property {any} [formData] - Data related to form fields in the document.
* @property {object} annotationsData - Data related to annotations in the document.
* @property {any[]} annotationsData.newAnnotations - An array of new annotations to be added.
* @property {any[]} annotationsData.updatedAnnotations - An array of updated annotations.
* @property {any[]} annotationsData.removedAnnotations - An array of removed annotations.
**/
export type DocumentModification = {
/**
* Specifies whether to render interactive forms.
**/
renderInteractiveForms?: boolean;
/**
* The rotation angle for the document.
**/
rotation?: number;
/**
* Data related to form fields in the document.
**/
formData?: any;
/**
* Data related to annotations in the document.
**/
annotationsData?: {
/**
* An array of new annotations to be added.
**/
newAnnotations: any[];
/**
* An array of updated annotations.
**/
updatedAnnotations: any[];
/**
* An array of removed annotations.
**/
removedAnnotations: any[];
};
};