Namespace: PDFNet

PDFNet

Contains PDFNetJS classes and functions

Classes

Action
ActionParameter
Annot
AnnotBorderStyle
AppearanceReferenceList
AttrObj
Bookmark
CADModule
CaretAnnot
CheckBoxWidget
ChunkRenderer
CircleAnnot
ClassMap
ColorPt
ColorSpace
ComboBoxWidget
ContentItem
ContentReplacer
ConversionMonitor
Convert
Date
Destination
DictIterator
DiffOptions
DigestAlgorithm
DigitalSignatureField
DisallowedChange
DocSnapshot
DocumentConversion
Element
ElementBuilder
ElementReader
ElementWriter
FDFDoc
FDFField
Field
FileAttachmentAnnot
FileSpec
Filter
FilterReader
FilterWriter
Flattener
Font
FreeTextAnnot
Function
GeometryCollection
GState
HighlightAnnot
Highlights
HTML2PDF
Image
InkAnnot
Iterator
KeyStrokeActionResult
KeyStrokeEventData
LineAnnot
LinkAnnot
ListBoxWidget
MarkupAnnot
Matrix2D
MovieAnnot
NameTree
NumberTree
Obj
ObjSet
OCG
OCGConfig
OCGContext
OCMD
OCRModule
Optimizer
OwnedBitmap
Page
PageLabel
PageSet
PatternColor
PDFACompliance
PDFDC
PDFDCEX
PDFDoc
PDFDocInfo
PDFDocViewPrefs
PDFDraw
PDFRasterizer
PDFView
PDFViewCtrl
Point
PolygonAnnot
PolyLineAnnot
PopupAnnot
PrinterMode
ProgressMonitor
PushButtonWidget
QuadPoint
RadioButtonGroup
RadioButtonWidget
Rect
Redaction
RedactionAnnot
Redactor
ResultSnapshot
RoleMap
RubberStampAnnot
ScreenAnnot
SDFDoc
SecurityHandler
SElement
Shading
SignatureHandler
SignatureWidget
SoundAnnot
SquareAnnot
SquigglyAnnot
Stamper
STree
StrikeOutAnnot
TextAnnot
TextExtractor
TextExtractorLine
TextExtractorStyle
TextExtractorWord
TextMarkupAnnot
TextSearch
TextWidget
TrustVerificationResult
UnderlineAnnot
UndoManager
VerificationOptions
VerificationResult
ViewChangeCollection
WatermarkAnnot
WidgetAnnot

Members


<static> CharacterOrdering

Properties:
Name Type Description
e_Identity number
e_Japan1 number
e_Japan2 number
e_GB1 number
e_CNS1 number
e_Korea1 number

<static> CMSType

Properties:
Name Type Description
e_lcms number
e_icm number
e_no_cms number

<static> LogLevel

Properties:
Name Type Description
e_LogLevel_Off number
e_LogLevel_Fatal number
e_LogLevel_Error number
e_LogLevel_Warning number
e_LogLevel_Info number
e_LogLevel_Trace number
e_LogLevel_Debug number

Methods


<static> addFontSubstFromName(fontname, fontpath)

Parameters:
Name Type Description
fontname string
fontpath string
Returns:
A promise that resolves to an object of type: "boolean"
Type
Promise.<boolean>

<static> addResourceSearchPath(path)

Sets the location of PDFNet resource file.
Parameters:
Name Type Description
path string The resource directory path to add to the search list.
Returns:
Type
Promise.<void>

<static> beginOperation( [optionsObj])

beginOperation locks all Emscripten worker operations on PDFNet so as to avoid potential editing conflicts. Calling beginOperation a second time before finishOperation is called will result in an exception being thrown. This can be disabled allowing multiple beginOperations to be called by passing in an options object (a default javascript object {}) with its parameter "allowMultipleInstances" set to "true". Will do nothing for Node.js
Parameters:
Name Type Argument Default Description
optionsObj Object <optional>
{}
Properties
Name Type Argument Default Description
allowMultipleInstances boolean <optional>
false If allowMultipleInstances set to true, multiple instances of beginOperation will be allowed.
Returns:
Type
Promise.<void>

<static> createDiffOptions()

Method to create a DiffOptions object
Returns:
A promise that resolves to a PDFNet.DiffOptions.
Type
Promise.<PDFNet.DiffOptions>

<static> deallocateAllObjects()

Removes all PDFNetJS objects from memory.
Returns:
Type
Promise.<void>

<static> displayAllocatedObjects()

Displays in the console a list of objects still in memory in the form of their type and ID.

<static> enableJavaScript(enable)

A switch that can be used to turn on/off JavaScript engine
Parameters:
Name Type Description
enable boolean true to enable JavaScript engine, false to disable.
Returns:
Type
Promise.<void>

<static> endDeallocateStack()

Deallocates all objects in memory that were created after the most recent startDeallocateStack call.
Returns:
Type
Promise.<void>

<static> finishOperation()

finishOperation releases the lock on all Emscripten worker operations on PDFNet. Will do nothing if PDFNet.beginOperation has not been called earlier. Will do nothing for Node.js
Returns:
Type
Promise.<void>

<static> getNormalizedUrl(url)

Parameters:
Name Type Description
url string
Returns:
A promise that resolves to an object of type: "string"
Type
Promise.<string>

<static> getStackCount()

Gets the number of PDFNet.startDeallocateStack() calls made that have not yet been ended.
Returns:
A promise that resolves to the number of PDFNet.startDeallocateStack() calls not yet ended.
Type
Promise.<number>

<static> getSystemFontList()

Get available fonts on the system.
Returns:
A promise that resolves to a JSON list of fonts accessible to PDFNet
Type
Promise.<string>

<static> getVersion()

Returns:
A promise that resolves to pDFNet version number.
Type
Promise.<number>

<static> initialize( [licenseKey] [, pdfBackendType])

Initializes PDFNet library. Initialize() is usually called once, during initialization.
Parameters:
Name Type Argument Description
licenseKey string <optional>
Optional license key used to activate the product. If the licenseKey is not specified or is null, the product will work in the demo mode.
pdfBackendType string <optional>
A string representing the "backend type" for rendering PDF documents. Pass "ems" to force the use of the ASM.js/WebAssembly worker and "pnacl" for the "PNaCl" worker.
Throws:
If the licenseKey is invalid, the function will throw an exception.
Returns:
Type
Promise.<void>

<static> isJavaScriptEnabled()

Test whether JavaScript is enabled
Returns:
A promise that resolves to true if it is enabled, false otherwise
Type
Promise.<boolean>

<static> pdfGetDownloadedByteCount(doc)

Parameters:
Name Type Description
doc PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc
Returns:
A promise that resolves to an object of type: "number"
Type
Promise.<number>

<static> pdfGetTotalRemoteByteCount(doc)

Parameters:
Name Type Description
doc PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc
Returns:
A promise that resolves to an object of type: "number"
Type
Promise.<number>

<static> runGeneratorWithCleanup(generator [, license_key])

This function is a utility method which will initialize PDFNet, begin a PDFNet operation execute an action defined by the first parameter generator and then finish this operation. This method will also clean up all PDFNet resources that are allocated within the generator which can greatly simplify user code. In some cases the user may wish to keep PDFNet objects alive out of the scope of this generator function in which case runGeneratorWithoutCleanup should be used instead.
Parameters:
Name Type Argument Description
generator Object The generator object function to execute.
license_key string <optional>
the license key used to initialize PDFNet.
Returns:
a promise that resolves to the return value of the generator.
Type
Promise.<any>

<static> runGeneratorWithoutCleanup(generator [, license_key])

This function is a utility method which will initialize PDFNet and execute an action defined by the first parameter generator. Unlike runGeneratorWithCleanup this method will not clean up PDFNet resources which can be useful when the user wishes to keep some of the objects alive.
Parameters:
Name Type Argument Description
generator object The generator object function to execute.
license_key string <optional>
the license key used to initialize PDFNet.
Returns:
a promise that resolves to the return value of the generator.
Type
Promise.<any>

<static> runWithCleanup(callback [, license_key])

This function is a utility method which will initialize PDFNet, begin a PDFNet operation and run a callback function passed in. This method will also clean up all PDFNet resources that are allocated within the function which can greatly simplify user code. In some cases the user may wish to keep PDFNet objects alive out of the scope of this function in which case runWithoutCleanup should be used instead.
Parameters:
Name Type Argument Description
callback function A callback function to execute
license_key string <optional>
the license key used to initialize PDFNet.
Returns:
a promise that resolves to the return value (if there is one) of the input function
Type
Promise.<any>

<static> runWithoutCleanup(callback [, license_key])

This function is a utility method which will initialize PDFNet and execute an input. Unlike runWithCleanup this method will not clean up PDFNet resources which can be useful if the user wishes to keep some of the objects alive.
Parameters:
Name Type Argument Description
callback function A callback function to execute
license_key string <optional>
the license key used to initialize PDFNet.
Returns:
a promise that resolves to the return value (if there is one) of the input function
Type
Promise.<any>

<static> setColorManagement( [t])

used to set a specific Color Management System (CMS) for use during color conversion operators, image rendering, etc.
Parameters:
Name Type Argument Description
t number <optional>
PDFNet.CMSType = {
	e_lcms : 0
	e_icm : 1
	e_no_cms : 2
}
identifies the type of color management to use.
Returns:
Type
Promise.<void>

<static> setDefaultDeviceRGBProfile(icc_filename)

Parameters:
Name Type Description
icc_filename string
Returns:
Type
Promise.<void>

<static> setDefaultFlateCompressionLevel(level)

sets the default compression level for Flate (ZLib).
Parameters:
Name Type Description
level number An integer in range 0-9 representing the compression value to use as a default for any Flate streams (e.g used to compress content streams, PNG images, etc). The library normally uses the default compression level (Z_DEFAULT_COMPRESSION). For most images, compression values in the range 3-6 compress nearly as well as higher levels, and do so much faster. For on-line applications it may be desirable to have maximum speed Z_BEST_SPEED = 1). You can also specify no compression (Z_NO_COMPRESSION = 0).
Default Value:
  • Z_DEFAULT_COMPRESSION (-1).
Returns:
Type
Promise.<void>

<static> setLogLevel( [level])

Parameters:
Name Type Argument Description
level number <optional>
PDFNet.LogLevel = {
	e_LogLevel_Off : -1
	e_LogLevel_Fatal : 5
	e_LogLevel_Error : 4
	e_LogLevel_Warning : 3
	e_LogLevel_Info : 2
	e_LogLevel_Trace : 1
	e_LogLevel_Debug : 0
}
Returns:
Type
Promise.<void>

<static> shutdown()

This function shuts down the native backend. It will ensure the program can terminate when it is finished.

<static> startDeallocateStack()

startDeallocateStack initializes a deallocation point. All functions which create objects that take up memory after the most recent startDeallocateStack call will be deallocated upon calling PDFNet.endDeallocateStack().
Returns:
Type
Promise.<void>