@pdftron/webviewer
Version:
[WebViewer](https://www.apryse.com/webviewer) is a powerful JavaScript Document SDK and UI Component Library that is a part of the [Apryse PDF SDK](https://www.apryse.com). It provides a slick, out-of-the-box responsive UI that interacts with the core lib
1,005 lines (998 loc) • 2.54 MB
TypeScript
export default WebViewer;
/**
* Contains PDFNetJS classes and functions
*/
export declare namespace Core.PDFNet {
/**
* Converter is a utility class used to convert documents and files to PDF.
Conversion of XPS, EMF and image files to PDF documents is performed internally.
Other document formats are converted via native application and printing.
*/
class Convert {
/**
* Method to create an XPSOutputOptions object
* @returns A promise that resolves to a PDFNet.Convert.XPSOutputOptions.
*/
static createXPSOutputOptions(): Promise<PDFNet.Convert.XPSOutputOptions>;
/**
* Method to create an XODOutputOptions object
* @returns A promise that resolves to a PDFNet.Convert.XODOutputOptions.
*/
static createXODOutputOptions(): Promise<PDFNet.Convert.XODOutputOptions>;
/**
* Method to create an TiffOutputOptions object
* @returns A promise that resolves to a PDFNet.Convert.TiffOutputOptions.
*/
static createTiffOutputOptions(): Promise<PDFNet.Convert.TiffOutputOptions>;
/**
* Method to create an HTMLOutputOptions object
* @returns A promise that resolves to a PDFNet.Convert.HTMLOutputOptions.
*/
static createHTMLOutputOptions(): Promise<PDFNet.Convert.HTMLOutputOptions>;
/**
* Method to create an EPUBOutputOptions object
* @returns A promise that resolves to a PDFNet.Convert.EPUBOutputOptions.
*/
static createEPUBOutputOptions(): Promise<PDFNet.Convert.EPUBOutputOptions>;
/**
* Method to create a OfficeToPDFOptions object.
* @param JSON - data containing options values for OfficeToPDFOptions.
* @returns A promise that resolves to a PDFNet.Convert.OfficeToPDFOptions.
*/
static createOfficeToPDFOptions(JSON: string): Promise<PDFNet.Convert.OfficeToPDFOptions>;
/**
* Convert the specified XPS document contained in memory to PDF
and append converted pages to the specified PDF document.
* @param in_pdfdoc - the PDFDoc to append to
* @param buf - the buffer containing the xps document
*/
static fromXpsMem(in_pdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, buf: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray): Promise<void>;
/**
* @returns A promise that resolves to an object of type: "PDFNet.Reflow"
*/
static createReflow(in_page: PDFNet.Page, json_zones: string): Promise<PDFNet.Reflow>;
/**
* Convert the specified plain text file contained in a buffer to PDF and append converted
* pages to the specified PDF document.
* @param in_pdfdoc - the PDFDoc to append to
* @param fileData - the buffer containing the plain text document to convert
* @param [options] - the conversion options. The available options are:
*
* | Option Name | Type | Note |
* |-------------------------|---------|---------------------------------------------------------|
* | BytesPerBite | Integer | In bytes. Use for streaming conversion only. |
* | FontFace | String | Set the font face used for the conversion. |
* | FontSize | Integer | Set the font size used for the conversion. |
* | LineHeightMultiplier | Double | Set the line height multiplier used for the conversion. |
* | MarginBottom | Double | In inches. Set the bottom margin of the page. |
* | MarginLeft | Double | In inches. Set the left margin of the page. |
* | MarginRight | Double | In inches. Set the right margin of the page. |
* | MarginTop | Double | In inches. Set the top margin of the page. |
* | PageHeight | Double | In inches. Set the page height. |
* | PageWidth | Double | In inches. Set the page width. |
* | UseSourceCodeFormatting | Boolean | Set whether to use mono font for the conversion. |
*/
static fromTextWithBuffer(in_pdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, fileData: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray, options?: PDFNet.Obj): Promise<void>;
/**
* Convert the PDFDoc to XPS and save to a buffer
* @param in_pdfdoc - the PDFDoc to convert to XPS
* @param [options] - the conversion
* @returns A promise that resolves to the XPS file in a buffer
*/
static toXpsBuffer(in_pdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, options?: PDFNet.Obj | PDFNet.Convert.XPSOutputOptions): Promise<Uint8Array>;
/**
* Convert the input file to XPS format and save to a buffer
* @param fileData - the file to convert to XPS
* @param fileType - the filename extension of the file.
* @param [options] - the conversion options
* @returns A promise that resolves to the XPS file in a buffer
*
* Note: Requires the Convert::Printer class for all file formats
* that ToPdf also requires.
*/
static fileToXpsWithBuffer(fileData: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray, fileType: string, options?: PDFNet.Obj | PDFNet.Convert.XPSOutputOptions): Promise<Uint8Array>;
/**
* Convert the input file to XOD format and save to a buffer
* @param fileData - the file to convert to XOD
* @param fileType - the filename extension of the file.
* @param [options] - the conversion options
* @returns A promise that resolves to the XOD file in a buffer
*
* Note: Requires the Convert::Printer class for all file formats
* that ToPdf also requires.
*/
static fileToXodWithBuffer(fileData: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray, fileType: string, options?: PDFNet.Obj | PDFNet.Convert.XODOutputOptions): Promise<Uint8Array>;
/**
* Convert the input file to XOD format and save to a buffer
* @param in_pdfdoc - the PDFDoc to convert to XOD
* @param [options] - the conversion options
* @returns A promise that resolves to the XOD file in a buffer
*/
static toXodBuffer(in_pdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, options?: PDFNet.Obj | PDFNet.Convert.XODOutputOptions): Promise<Uint8Array>;
/**
* Convert the an office document (in .docx, .xlsx, pptx, or .doc format) to pdf and append to the specified PDF document.
This conversion is performed entirely within PDFNet, and does not rely on Word
interop or any other external functionality.
Note: Font requirements: on some systems you may need to specify extra font resources to aid
in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion
* @param in_pdfdoc - the conversion result will be appended to this pdf.
* @param in_stream - the source document data.
* @param [options] - the conversion options
*/
static officeToPdfWithFilter(in_pdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, in_stream: PDFNet.Filter, options?: PDFNet.Obj | PDFNet.Convert.ConversionOptions): Promise<void>;
/**
* Convert the file or document to PDF and append to the specified PDF document
* @param in_pdfdoc - the PDFDoc to append the converted document to. The
* PDFDoc can then be converted to XPS, EMF or SVG using the other functions
* in this class.
* @param fileData - the buffer containing the document to be converted to pdf
* @param fileType - the filename extension of the document.
*
* Note: Internally formats include BMP, EMF, JPEG, PNG, TIF, XPS.
*
* Note: Formats that require external applications for conversion use the
* Convert::Printer class and the PDFNet printer to be installed. This is
* only supported on Windows platforms. Document formats in this category
* include RTF(MS Word or Wordpad), TXT (Notepad or Wordpad), DOC and DOCX
* (MS Word), PPT and PPTX (MS PowerPoint), XLS and XLSX (MS Excel),
* OpenOffice documents, HTML and MHT (Internet Explorer), PUB (MS Publisher),
* MSG (MS Outlook).
*/
static toPdfWithBuffer(in_pdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, fileData: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray, fileType: string): Promise<void>;
/**
* Convert the specified TIFF filter to PDF and append converted pages to the specified PDF document.
* @param in_pdfdoc - the PDFDoc to append to
* @param in_data - the source TIFF data.
*/
static fromTiff(in_pdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, in_data: PDFNet.Filter): Promise<void>;
/**
* Convert a page to HTML and return a string of the html
* @param page - the page to convert to HTML
* @returns A promise that resolves to a string containing the page's html
*/
static pageToHtml(page: PDFNet.Page): Promise<string>;
/**
* @returns A promise that resolves to an object of type: "string"
*/
static pageToHtmlZoned(page: PDFNet.Page, json_zones: string): Promise<string>;
/**
* Convert a file in a buffer to multipage TIFF
* @param fileData - buffer containing the file to convert to multipage TIFF
* @param fileType - the filename extension of the file.
* @param [options] - the conversion options
* @returns A promise that resolves to the TIFF file in an buffer
*/
static fileToTiffWithBuffer(fileData: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray, fileType: string, options?: PDFNet.Obj | PDFNet.Convert.TiffOutputOptions): Promise<Uint8Array>;
/**
* Convert the PDF to multipage TIFF
* @param in_pdfdoc - the PDF doc to convert to multipage
* @param [options] - the conversion options
* @returns A promise that resolves to the TIFF file in an buffer
*/
static toTiffBuffer(in_pdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, options?: PDFNet.Obj | PDFNet.Convert.TiffOutputOptions): Promise<Uint8Array>;
/**
* Convert a file to multipage TIFF and write to the provided filter
* @param in_filename - the file to convert to multipage TIFF
* @param [options] - the conversion options
* @returns A promise that resolves to an object of type: "PDFNet.Filter"
*/
static fileToTiffWithFilterWithBuffer(in_filename: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray, options?: PDFNet.Obj | PDFNet.Convert.TiffOutputOptions): Promise<PDFNet.Filter>;
/**
* Convert the PDF to multipage TIFF and write to the provided filter
* @param in_pdfdoc - the PDF doc to convert to multipage TIFF
* @param [options] - the conversion options
* @returns A promise that resolves to an object of type: "PDFNet.Filter"
*/
static toTiffWithFilter(in_pdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, options?: PDFNet.Obj | PDFNet.Convert.TiffOutputOptions): Promise<PDFNet.Filter>;
/**
* Convert the an office document (in .docx, .xlsx, pptx, or .doc format) to pdf.
* @param input - Either a url from which to download the file or an ArrayBuffer containing the file data.
* @param options - An object containing conversion options
* @returns A promise that resolves to a "PDFDoc".
*/
static office2PDF(input: string | ArrayBuffer, options: any): Promise<PDFNet.PDFDoc>;
}
/**
* The Optimizer class provides functionality for optimizing/shrinking
output PDF files.
'pdftron.PDF.Optimizer' is an optional PDFNet Add-On utility class that can be
used to optimize PDF documents by reducing the file size, removing redundant
information, and compressing data streams using the latest in image compression
technology. PDF Optimizer can compress and shrink PDF file size with the
following operations:
- Remove duplicated fonts, images, ICC profiles, and any other data stream.
- Optionally convert high-quality or print-ready PDF files to small, efficient and web-ready PDF.
- Optionally down-sample large images to a given resolution.
- Optionally compress or recompress PDF images using JBIG2 and JPEG2000 compression formats.
- Compress uncompressed streams and remove unused PDF objects.
Note: 'Optimizer' is available as a separately licensable add-on to PDFNet
core license.
Note: See 'pdftron.PDF.Flattener' for alternate approach to optimize PDFs for fast
viewing on mobile devices and the Web.
*/
class Optimizer {
/**
* Method to create an ImageSettings object
* @returns A promise that resolves to a PDFNet.Optimizer.ImageSettings.
*/
static createImageSettings(): Promise<PDFNet.Optimizer.ImageSettings>;
/**
* Method to create an MonoImageSettings object
* @returns A promise that resolves to a PDFNet.Optimizer.MonoImageSettings.
*/
static createMonoImageSettings(): Promise<PDFNet.Optimizer.MonoImageSettings>;
/**
* Method to create an TextSettings object
* @returns A promise that resolves to a PDFNet.Optimizer.TextSettings.
*/
static createTextSettings(): Promise<PDFNet.Optimizer.TextSettings>;
/**
* Method to create an OptimizerSettings object
* @returns A promise that resolves to a PDFNet.Optimizer.OptimizerSettings.
*/
static createOptimizerSettings(): Promise<PDFNet.Optimizer.OptimizerSettings>;
/**
* Optimize the given document using the optimizers settings
* @param doc - the document to optimize
* @param [optimizerSettings] - the settings for the optimizer
*/
static optimize(doc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, optimizerSettings?: any): Promise<void>;
}
/**
* An abstract class containing utility functions for destroyable classes.
*/
class Destroyable {
/**
* Take the ownership of this object, so that PDFNet.runWithCleanup won't destroy this object.
*/
takeOwnership(): void;
/**
* Destructor
*/
destroy(): Promise<void>;
}
/**
* Actions are typically what happens when a user clicks on a link or bookmark.
*
* Instead of simply jumping to a destination in the document, an annotation or
* outline item can specify an action for the viewer application to perform, such
* as launching an application, playing a sound, or changing an annotation's
* appearance state.
*
* Note: Although the Action class provides utility functions for most commonly used
* action types, it is possible to read, write, and edit any action type using SDF API
* and dictionary entries described in Section 8.5 in the PDF Reference Manual.
*/
class Action {
/**
* Creates a new 'GoTo'action. GoTo action takes the user to the
* specified Destination view located in the same document.
* @param dest - A Destination for the new Action.
*
* Note: This method can only be used for destinations in the same
* document as the source document. For cross-document links use
* Action::CreateGotoRemote().
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createGoto(dest: PDFNet.Destination): Promise<PDFNet.Action>;
/**
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createGotoWithKey(key: string, dest: PDFNet.Destination): Promise<PDFNet.Action>;
/**
* Creates a new 'GoToR'action. A remote go-to action is similar to an
* ordinary go-to action but jumps to a destination in another PDF file
* instead of the current file.
* @param file - The file referred to by the action.
* @param page_num - A page number within the remote document. The first page is
* numbered 0.
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createGotoRemote(file: PDFNet.FileSpec, page_num: number): Promise<PDFNet.Action>;
/**
* Creates a new 'GoToR'action. See the above method for details.
* @param file - The file referred to by the action.
* @param page_num - A page number within the remote document. The first page is
* numbered 0.
* @param new_window - A flag specifying whether to open the destination document
* in a new window. If new_window is false, the destination document replaces
* the current document in the same window, otherwise the viewer application
* should behave in accordance with the current user preference.
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createGotoRemoteSetNewWindow(file: PDFNet.FileSpec, page_num: number, new_window: boolean): Promise<PDFNet.Action>;
/**
* Create a new URI action. The URI action is typically resolved by opening a URL in
* the default web browser.
* @param sdfdoc - The document in which to create the action.
* @param uri - The uniform resource identifier to resolve, encoded in 7-bit ASCII.
* A uniform resource identifier (URI) is a string that identifies (resolves to) a resource
* on the Internet; typically a file that is the destination of a hypertext link, although
* it can also resolve to a query or other entity. (URIs are described in Internet RFC 2396,
* Uniform Resource Identifiers (URI).
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createURI(sdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, uri: string): Promise<PDFNet.Action>;
/**
* Create a new URI action. The URI action is typically resolved by opening a URL in
* the default web browser.
* @param sdfdoc - The document in which to create the action.
* @param uri - The uniform resource identifier to resolve, encoded in UTF-8.
* A uniform resource identifier (URI) is a string that identifies (resolves to) a resource
* on the Internet; typically a file that is the destination of a hypertext link, although
* it can also resolve to a query or other entity. (URIs are described in Internet RFC 2396,
* Uniform Resource Identifiers (URI).
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createURIWithUString(sdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, uri: string): Promise<PDFNet.Action>;
/**
* Creates a new 'SubmitForm'action. A submit-form action transmits the names
* and values of selected interactive form fields to a specified uniform
* resource locator (URL), presumably the address of a Web server that will
* process them and send back a response.
* @param url - A URL file specification giving the uniform resource locator (URL)
* of the script at the Web server that will process the submission.
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createSubmitForm(url: PDFNet.FileSpec): Promise<PDFNet.Action>;
/**
* Creates a new 'Launch' action. A launch action opens up a file using the
* most appropriate program.
* @param sdfdoc - the document in which to create the action
* @param path - the full path of the file to be opened
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createLaunch(sdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, path: string): Promise<PDFNet.Action>;
/**
* Creates a new 'Show/Hide Field' action. A show/hide field action shows
* or hide certain fields when it's invoked.
* @param sdfdoc - the document in which to create the action
* @param field_names_list - the list of fields to hide
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createHideField(sdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, field_names_list: string[]): Promise<PDFNet.Action>;
/**
* Creates a new 'Import Data' action. An import data action imports
* form data from a FDF file into a PDF document.
* @param sdfdoc - the document in which to create the action
* @param path - the full path of the FDF file
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createImportData(sdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, path: string): Promise<PDFNet.Action>;
/**
* Creates a new 'Reset Form' action. A reset form action reset chosen
* form fields to their default value.
* @param sdfdoc - the document in which to create the action
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createResetForm(sdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc): Promise<PDFNet.Action>;
/**
* Creates a new 'JavaScript' action. A javascript action executes a JavaScript
* script when it's invoked.
* @param sdfdoc - the document in which to create the action
* @param script - the JavaScript script to be executed
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static createJavaScript(sdfdoc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, script: string): Promise<PDFNet.Action>;
/**
* A constructor. Creates an Action and initializes it using given Cos/SDF object.
* @param [in_obj] - Pointer to the Cos/SDF object.
*
* Note: The constructor does not copy any data, but is instead the logical
* equivalent of a type cast.
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
static create(in_obj?: PDFNet.Obj): Promise<PDFNet.Action>;
/**
* Copy Constructor
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
copy(): Promise<PDFNet.Action>;
/**
* Compares two Action objects for equality.
* @param in_action - A reference to an existing Action object.
* @returns A promise that resolves to true if the both Actions share the same underlying SDF/Cos object; otherwise false.
*/
compare(in_action: PDFNet.Action): Promise<boolean>;
/**
* Indicates whether the Action is valid (non-null).
* @returns A promise that resolves to true if this is a valid (non-null) Action; otherwise false.
*
* Note: If this method returns false the underlying SDF/Cos object is null and
* the Action object should be treated as null as well.
*/
isValid(): Promise<boolean>;
/**
* @returns A promise that resolves to an object of type: "string"
*/
getXFDF(): Promise<string>;
/**
* @example
* Return value enum:
* <pre>
* PDFNet.Action.Type = {
* e_GoTo : 0
* e_GoToR : 1
* e_GoToE : 2
* e_Launch : 3
* e_Thread : 4
* e_URI : 5
* e_Sound : 6
* e_Movie : 7
* e_Hide : 8
* e_Named : 9
* e_SubmitForm : 10
* e_ResetForm : 11
* e_ImportData : 12
* e_JavaScript : 13
* e_SetOCGState : 14
* e_Rendition : 15
* e_Trans : 16
* e_GoTo3DView : 17
* e_RichMediaExecute : 18
* e_Unknown : 19
* }
* </pre>
* @returns A promise that resolves to the type of this Action.
*/
getType(): Promise<number>;
/**
* @returns A promise that resolves to the Action's Destination view.
*
* Note: This only works for Actions whose subtype is "GoTo".
*
* Note: All named destinations are automatically resolved to the
* explicit destination so you can access destination members directly.
*/
getDest(): Promise<PDFNet.Destination>;
/**
* @returns A promise that resolves to the next action dictionary, an array of action dictionaries,
* or NULL if there are no additional actions.
*
* Sequences of actions can be chained together. For example, the effect
* of clicking a link annotation with the mouse might be to play a sound,
* jump to a new page, and start up a movie. Note that the Next entry is
* not restricted to a single action but may contain an array of actions,
* each of which in turn may have a Next entry of its own. The actions may
* thus form a tree instead of a simple linked list. Actions within each
* Next array are executed in order, each followed in turn by any actions
* specified in its Next entry, and so on recursively.
*/
getNext(): Promise<PDFNet.Obj>;
/**
* @returns A promise that resolves to pointer to the underlying SDF/Cos object.
*/
getSDFObj(): Promise<PDFNet.Obj>;
/**
* @param flag - <pre>
* PDFNet.Action.FormActionFlag = {
* e_exclude : 0
* e_include_no_value_fields : 1
* e_export_format : 2
* e_get_method : 3
* e_submit_coordinates : 4
* e_xfdf : 5
* e_include_append_saves : 6
* e_include_annotations : 7
* e_submit_pdf : 8
* e_canonical_format : 9
* e_excl_non_user_annots : 10
* e_excl_F_key : 11
* e_embed_form : 13
* }
* </pre>
* Action flag to get the value from.
* @returns A promise that resolves to boolean value of the given action flag.
* Note: Action flags are currently only used by submit and reset form actions.
*/
getFormActionFlag(flag: number): Promise<boolean>;
/**
* Set the value of a given field flag.
* @param flag - <pre>
* PDFNet.Action.FormActionFlag = {
* e_exclude : 0
* e_include_no_value_fields : 1
* e_export_format : 2
* e_get_method : 3
* e_submit_coordinates : 4
* e_xfdf : 5
* e_include_append_saves : 6
* e_include_annotations : 7
* e_submit_pdf : 8
* e_canonical_format : 9
* e_excl_non_user_annots : 10
* e_excl_F_key : 11
* e_embed_form : 13
* }
* </pre>
* Action flag to get the value from.
* @param value - Boolean to set the value of the flag to.
* Action flags are currently only used by submit and reset form actions.
*/
setFormActionFlag(flag: number, value: boolean): Promise<void>;
/**
* Test if the action needs writeLock
* @returns A promise that resolves to ture if needs, otherwise false
*/
needsWriteLock(): Promise<boolean>;
/**
* Executes current action; this will only work for some action types that can be executed
* only using the information contained in the action object or the associated PDF doc.
* See also PDFViewCtrl::ExecuteAction()
*/
execute(): Promise<void>;
/**
* Executes KeyStrokeAction, this shall be performed when the user modifies a character in a text field
* or combo box or modifies the selecton in a scrollable list box. This action checks the added text for
* validity and reject or modify it.
* @param data - Data that contains previous text, added text,and added position information.
* @returns A promise that resolves to an object of type: "PDFNet.KeyStrokeActionResult"
*/
executeKeyStrokeAction(data: PDFNet.KeyStrokeEventData): Promise<PDFNet.KeyStrokeActionResult>;
/**
* @returns A promise that resolves to an object of type: "PDFNet.ActionParameter"
*/
parameterCreateWithField(field: PDFNet.Field): Promise<PDFNet.ActionParameter>;
/**
* @returns A promise that resolves to an object of type: "PDFNet.ActionParameter"
*/
parameterCreateWithAnnot(annot: PDFNet.Annot): Promise<PDFNet.ActionParameter>;
/**
* @returns A promise that resolves to an object of type: "PDFNet.ActionParameter"
*/
parameterCreateWithPage(page: PDFNet.Page): Promise<PDFNet.ActionParameter>;
}
/**
* ActionParameter is a class used to describe all the information needed to
execute an action. In most cases only the action itself is necessary since
the document can be inferred from associated SDF::Obj, however some actions
particularly JavaScript actions on Field or Annot objects need access to
the associated Field or Annot object.
*/
class ActionParameter extends PDFNet.Destroyable {
/**
* Constructor
* @returns A promise that resolves to an object of type: "PDFNet.ActionParameter"
*/
static create(action: PDFNet.Action): Promise<PDFNet.ActionParameter>;
/**
* @returns A promise that resolves to an object of type: "PDFNet.Action"
*/
getAction(): Promise<PDFNet.Action>;
}
/**
* The class AdvancedImagingModule.
* static interface to PDFTron SDKs AdvancedImaging functionality
*/
class AdvancedImagingModule {
}
/**
* This class represents an algorithm identifier, as defined by ITU and
* used in X.509.
*/
class AlgorithmIdentifier extends PDFNet.Destroyable {
/**
* Constructs an AlgorithmIdentifier from a Predefined enum.
* @param oid_type - <pre>
* PDFNet.ObjectIdentifier.Predefined = {
* e_commonName : 0
* e_surname : 1
* e_countryName : 2
* e_localityName : 3
* e_stateOrProvinceName : 4
* e_streetAddress : 5
* e_organizationName : 6
* e_organizationalUnitName : 7
* e_SHA1 : 8
* e_SHA256 : 9
* e_SHA384 : 10
* e_SHA512 : 11
* e_RIPEMD160 : 12
* e_RSA_encryption_PKCS1 : 13
* e_RSASSA_PSS : 14
* e_MGF1 : 15
* }
* </pre>
* The Predefined enumerated value to use.
* @returns A promise that resolves to an object of type: "PDFNet.AlgorithmIdentifier"
*/
static createFromPredefined(oid_type: number): Promise<PDFNet.AlgorithmIdentifier>;
/**
* Constructs an AlgorithmIdentifier from an ObjectIdentifier.
* @param oid - The ObjectIdentifier object to use.
* @returns A promise that resolves to an object of type: "PDFNet.AlgorithmIdentifier"
*/
static createFromObjectIdentifier(oid: PDFNet.ObjectIdentifier): Promise<PDFNet.AlgorithmIdentifier>;
/**
* Constructs an AlgorithmIdentifier from a DigestAlgorithm enum.
* @param digest_algorithm_type - <pre>
* PDFNet.DigestAlgorithm.Type = {
* e_SHA1 : 0
* e_SHA256 : 1
* e_SHA384 : 2
* e_SHA512 : 3
* e_RIPEMD160 : 4
* e_unknown_digest_algorithm : 5
* }
* </pre>
* The enumeration value corresponding to your desired digest algorithm.
* @returns A promise that resolves to an object of type: "PDFNet.AlgorithmIdentifier"
*/
static createFromDigestAlgorithm(digest_algorithm_type: number): Promise<PDFNet.AlgorithmIdentifier>;
/**
* Constructs an AlgorithmIdentifier from a Predefined enum and an AlgorithmParams object.
* @param oid_type - <pre>
* PDFNet.ObjectIdentifier.Predefined = {
* e_commonName : 0
* e_surname : 1
* e_countryName : 2
* e_localityName : 3
* e_stateOrProvinceName : 4
* e_streetAddress : 5
* e_organizationName : 6
* e_organizationalUnitName : 7
* e_SHA1 : 8
* e_SHA256 : 9
* e_SHA384 : 10
* e_SHA512 : 11
* e_RIPEMD160 : 12
* e_RSA_encryption_PKCS1 : 13
* e_RSASSA_PSS : 14
* e_MGF1 : 15
* }
* </pre>
* The Predefined enumerated value to use.
* @param params - The AlgorithmParams object to use.
* @returns A promise that resolves to an object of type: "PDFNet.AlgorithmIdentifier"
*/
static createFromPredefinedAndParams(oid_type: number, params: PDFNet.AlgorithmParams): Promise<PDFNet.AlgorithmIdentifier>;
/**
* Constructs an AlgorithmIdentifier from an ObjectIdentifier and an AlgorithmParams object.
* @param oid - The ObjectIdentifier object to use.
* @param params - The AlgorithmParams object to use.
* @returns A promise that resolves to an object of type: "PDFNet.AlgorithmIdentifier"
*/
static createFromObjectIdentifierAndParams(oid: PDFNet.ObjectIdentifier, params: PDFNet.AlgorithmParams): Promise<PDFNet.AlgorithmIdentifier>;
/**
* Constructs an AlgorithmIdentifier from a DigestAlgorithm enum and an AlgorithmParams object.
* @param digest_algorithm_type - <pre>
* PDFNet.DigestAlgorithm.Type = {
* e_SHA1 : 0
* e_SHA256 : 1
* e_SHA384 : 2
* e_SHA512 : 3
* e_RIPEMD160 : 4
* e_unknown_digest_algorithm : 5
* }
* </pre>
* The enumeration value corresponding to your desired digest algorithm.
* @param params - The AlgorithmParams object to use.
* @returns A promise that resolves to an object of type: "PDFNet.AlgorithmIdentifier"
*/
static createFromDigestAlgorithmAndParams(digest_algorithm_type: number, params: PDFNet.AlgorithmParams): Promise<PDFNet.AlgorithmIdentifier>;
}
/**
* Base class for AlgorithmIdentifier parameters.
*/
class AlgorithmParams extends PDFNet.Destroyable {
}
/**
* Annot is a base class for different types of annotations. For annotation
* specific properties, please refer to derived classes.
*
* An annotation is an interactive object placed on a page, such as a text note, a link,
* or an embedded file. PDF includes a wide variety of standard annotation types.
* An annotation associates an object such as a widget, note, or movie with a location
* on a page of a PDF document, or provides a means of interacting with the user
* via the mouse and keyboard. For more details on PDF annotations please refer to
* section 12.5 in the PDF Reference Manual and the documentation in derived classes.
*/
class Annot {
/**
* Creates a new annotation of a given type, in the specified document.
* The newly created annotation does not contain any properties specific
* to a given annotation type, which means an invalid annotation object could be created.
* It is therefore recommended to always create an annotation using type specific methods,
* such as Annots::Line::Create() or Annots::FileAttachment::Create().
* Users should only call Annot::Create() to create annotations of non-standard types
* that are not recognized by PDFTron software (by using Annot::e_Unknown as a type).
* @param doc - A document to which the annotation is added.
* @param type - <pre>
* PDFNet.Annot.Type = {
* e_Text : 0
* e_Link : 1
* e_FreeText : 2
* e_Line : 3
* e_Square : 4
* e_Circle : 5
* e_Polygon : 6
* e_Polyline : 7
* e_Highlight : 8
* e_Underline : 9
* e_Squiggly : 10
* e_StrikeOut : 11
* e_Stamp : 12
* e_Caret : 13
* e_Ink : 14
* e_Popup : 15
* e_FileAttachment : 16
* e_Sound : 17
* e_Movie : 18
* e_Widget : 19
* e_Screen : 20
* e_PrinterMark : 21
* e_TrapNet : 22
* e_Watermark : 23
* e_3D : 24
* e_Redact : 25
* e_Projection : 26
* e_RichMedia : 27
* e_Unknown : 28
* }
* </pre>
* Subtype of annotation to create.
* @param pos - A rectangle specifying the annotation's bounds, specified in
* user space coordinates.
* @returns A promise that resolves to a newly created blank annotation for the given annotation type.
*/
static create(doc: PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc, type: number, pos: PDFNet.Rect): Promise<PDFNet.Annot>;
/**
* Create an annotation and initialize it using given Cos/SDF object.
* @param [d] - The Cos/SDF object to initialze the annotation with.
* Note: The constructor does not copy any data, but is instead the logical
* equivalent of a type cast.
* @returns A promise that resolves to an object of type: "PDFNet.Annot"
*/
static createFromObj(d?: PDFNet.Obj): Promise<PDFNet.Annot>;
/**
* Copy Constructor
* @returns A promise that resolves to an object of type: "PDFNet.Annot"
*/
copy(): Promise<PDFNet.Annot>;
/**
* Compares two annotations for equality. The comparison will return true
* only if both annotations share the same underlying SDF/Cos object.
* @param d - Annotation to compare to
* @returns A promise that resolves to an object of type: "boolean"
*/
compare(d: PDFNet.Annot): Promise<boolean>;
/**
* @returns A promise that resolves to true if this is a valid (non-null) annotation, false otherwise.
* If the function returns false the underlying SDF/Cos object is null or is
* not valid and the annotation object should be treated as a null object.
*/
isValid(): Promise<boolean>;
/**
* @returns A promise that resolves to the underlying SDF/Cos object.
*/
getSDFObj(): Promise<PDFNet.Obj>;
/**
* @example
* Return value enum:
* <pre>
* PDFNet.Annot.Type = {
* e_Text : 0
* e_Link : 1
* e_FreeText : 2
* e_Line : 3
* e_Square : 4
* e_Circle : 5
* e_Polygon : 6
* e_Polyline : 7
* e_Highlight : 8
* e_Underline : 9
* e_Squiggly : 10
* e_StrikeOut : 11
* e_Stamp : 12
* e_Caret : 13
* e_Ink : 14
* e_Popup : 15
* e_FileAttachment : 16
* e_Sound : 17
* e_Movie : 18
* e_Widget : 19
* e_Screen : 20
* e_PrinterMark : 21
* e_TrapNet : 22
* e_Watermark : 23
* e_3D : 24
* e_Redact : 25
* e_Projection : 26
* e_RichMedia : 27
* e_Unknown : 28
* }
* </pre>
* @returns A promise that resolves to the type of this annotation. Corresponds to the "Subtype" entry of annotation
* dictionary, as per PDF Reference Manual section 12.5.2
*/
getType(): Promise<number>;
/**
* Return true if this annotation is classified as a markup annotation.
* @returns A promise that resolves to boolean value, true if this annotation is classified as a markup annotation.
*/
isMarkup(): Promise<boolean>;
/**
* @returns A promise that resolves to annotation's bounding rectangle, specified in user space coordinates.
*
* The meaning of the rectangle depends on the annotation type. For Link and RubberStamp
* annotations, the rectangle specifies the area containing the hyperlink area or stamp.
* For Note annotations, the rectangle is describing the popup window when it's opened.
* When it's closed, the icon is positioned at lower left corner.
*/
getRect(): Promise<PDFNet.Rect>;
/**
* It is possible during viewing that GetRect does not return the most accurate bounding box
* of what is actually rendered. This method calculates the bounding box, rather than relying
* on what is specified in the PDF document. The bounding box is defined as the smallest
* rectangle that includes all the visible content on the annotation.
* @returns A promise that resolves to the bounding box for this annotation. The dimensions are specified in user space
* coordinates.
*/
getVisibleContentBox(): Promise<PDFNet.Rect>;
/**
* Sets the size and location of an annotation on its page.
* @param pos - Annotation's bounding rectangle, specified in user space coordinates.
*
* The meaning of the rectangle depends on the annotation type. For Link and RubberStamp
* annotations, the rectangle specifies the area containing the hyperlink area or stamp.
* For Note annotations, the rectangle is describing the popup window when it's opened.
* When it's closed, the icon is positioned at lower left corner.
*/
setRect(pos: PDFNet.Rect): Promise<void>;
/**
* Scales the geometry of the annotation so that its appearance would now fit a new
* rectangle on the page, in user units. Users still have to call RefreshAppearance() later
* if they want a corresponding appearance stream to be generated for the new rectangle.
* The main reason for not combining the two operations together is to be able to resize
* annotations that do not have an appearance stream.
* @param newrect - A reference to the new rectangle to which this annotation has to be resized.
*/
resize(newrect: PDFNet.Rect): Promise<void>;
/**
* Sets the content of this annotation. (Optional).
* @param contents - A reference to unicode string object with the text that will be associated with
* this annotation. This is the text that annotation displays on user interaction, if the annotation
* type supports it.
*/
setContents(contents: string): Promise<void>;
/**
* Extract the content of this annotation. (Optional).
* @returns A promise that resolves to A unicode string object with the text that is associated with
* this annotation. This is the text that annotation displays on user interaction,
* if the annotation type supports it.
*/
getContents(): Promise<string>;
/**
* Get the Action associated with the selected Annot Trigger event.
* @param trigger - <pre>
* PDFNet.Annot.EventType = {
* e_action_trigger_activate : 0
* e_action_trigger_annot_enter : 1
* e_action_trigger_annot_exit : 2
* e_action_trigger_annot_down : 3
* e_action_trigger_annot_up : 4
* e_action_trigger_annot_focus : 5
* e_action_trigger_annot_blur : 6
* e_action_trigger_annot_page_open : 7
* e_action_trigger_annot_page_close : 8
* e_action_trigger_annot_page_visible : 9
* e_action_trigger_annot_page_invisible : 10
* }
* </pre>
* the type of trigger event to get
* @returns A promise that resolves to the Action Obj if present, otherwise NULL
*/
getTriggerAction(trigger: number): Promise<PDFNet.Obj>;
/**
* Returns custom data associated with the given key.
* @param key - The key for which to retrieve the associated data.
* @returns A promise that resolves to the custom data string. If no data is available an empty string is returned.
*/
getCustomData(key: string): Promise<string>;
/**
* Sets the custom data associated with the specified key.
* @param key - The key under which to store this custom data
* @param value - The custom data string to store
*/
setCustomData(key: string, value: string): Promise<void>;
/**
* Deletes custom data associated with the given key.
* @param key - The key for which to delete the associated data.
*/
deleteCustomData(key: string): Promise<void>;
/**
* Gets the page the annotation is associated with.
* @returns A promise that resolves to a Page object or null page object if the page reference is not available.
* The page object returned is an indirect reference to the page object with which
* this annotation is associated.
* This entry shall be present in screen annotations associated with rendition actions.
*
* Optional. PDF 1.3 PDF 1.4 PDF 1.5 not used in FDF files.
*/
getPage(): Promise<PDFNet.Page>;
/**
* Sets the reference to a page the annotation is associated with.
* (Optional PDF 1.3; not used in FDF files)
* @param page - The page object user wants the annotation to be associated with.
*
* Note: The parameter should be an indirect reference to the page object with
* which this annotation is associated. This entry shall be present in screen
* annotations associated with rendition actions
*/
setPage(page: PDFNet.Page): Promise<void>;
/**
* @returns A promise that resolves to the unique identifier for this annotation, or NULL if the identifier is not
* available. The returned value is a String object and is the value of the "NM"
* field, which was added as an optional attribute in PDF 1.4.
*/
getUniqueID(): Promise<PDFNet.Obj>;
/**
* Sets the unique identifier for this annotation.
* @param id - A buffer containing a unique identifier for this annotation.
* Note: It is necessary to ensure that the unique ID generated is actually unique.
*/
setUniqueID(id: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray): Promise<void>;
/**
* Gets an annotation's last modified date.
* @returns A promise that resolves to the annotation's last modified time and date. If the annotation has no associated
* date structure, the returned date is not valid (date.IsValid() returns false). Corresponds
* to the "M" entry of the annotation dictionary.
*/
getDate(): Promise<PDFNet.Date>;
/**
* Sets an annotation's last modified date.
* @param date - The annotation's last modified time and date. Corresponds to the "M" entry of the
* annotation dictionary.
*/
setDate(date: PDFNet.Date): Promise<void>;
/**
* @param flag - <pre>
* PDFNet.Annot.Flag = {
* e_invisible : 0
* e_hidden : 1
* e_print : 2
* e_no_zoom : 3
* e_no_rotate : 4
* e_no_view : 5
* e_annot_read_only : 6
* e_locked : 7
* e_toggle_no_view : 8
* e_locked_contents : 9
* }
* </pre>
* The Flag property to query.
* @returns A promise that resolves to the value of given Flag
*/
getFlag(flag: number): Promise<boolean>;
/**
* Sets the value of given Flag.
* @param flag - <pre>
* PDFNet.Annot.Flag = {
* e_invisible : 0
* e_hidden : 1
* e_print : 2
* e_no_zoom : 3
* e_no_rotate : 4
* e_no_view : 5
* e_annot_read_only : 6
* e_locked : 7
* e_toggle_no_view : 8
* e_locked_contents : 9
* }
* </pre>
* The Flag property to modify.
* @param value - The new value for the property.
*/
setFlag(flag: number, value: boolean): Promise<void>;
/**
* Gets the annotation's appearance for the given combination of annotation
* and appearance states.
* @param [annot_state] - <pre>
* PDFNet.Annot.State = {
* e_normal : 0
* e_rollover : 1
* e_down : 2
* }
* </pre>
* the annotation's appearance state, which selects the applicable
* appearance stream from the appearance sub-dictionary. An anno