@mescius/dspdfviewer
Version:
Document Solutions PDF Viewer
190 lines (189 loc) • 7.33 kB
TypeScript
import { SharedAccessMode } from "../SharedDocuments/types";
/**
* Represents the data extracted from a table, including rows, columns, and individual cell details.
*
* @typedef {Object} ExtractedTableData
* @property {{ length: number }[]} rows - An array representing the rows in the table, each with a `length` property indicating the number of cells in the row.
* @property {{ length: number }[]} cols - An array representing the columns in the table, each with a `length` property indicating the number of cells in the column.
* @property {{ row: number, col: number, spanRows: number, spanCols: number, text: string }[]} cells - An array of cell objects, each containing:
* - `row` {number} - The row index of the cell.
* - `col` {number} - The column index of the cell.
* - `spanRows` {number} - The number of rows this cell spans.
* - `spanCols` {number} - The number of columns this cell spans.
* - `text` {string} - The text content of the cell.
*/
export type ExtractedTableData = {
rows: {
length: number;
}[];
cols: {
length: number;
}[];
cells: {
row: number;
col: number;
spanRows: number;
spanCols: number;
text: string;
}[];
};
/**
* Specifies the available formats for exporting table data.
*
* @typedef {("csv" | "json" | "xlsx" | "xml" | "html")} TableDataExportFormat
*
* @description
* The following formats are supported for exporting table data:
*
* - `"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 = "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[];
};
};