Namespace: PDFNet

PDFNet

Contains PDFNetJS classes and functions

Classes

Action
ActionParameter
Annot
AnnotBorderStyle
AppearanceReferenceList
AttrObj
Bookmark
CaretAnnot
CheckBoxWidget
ChunkRenderer
CircleAnnot
ClassMap
ColorPt
ColorSpace
ComboBoxWidget
ContentItem
ContentReplacer
ConversionMonitor
Convert
Date
Destination
DictIterator
DiffOptions
DigitalSignatureField
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
Optimizer
OwnedBitmap
Page
PageLabel
PageSet
PatternColor
PDFACompliance
PDFDC
PDFDCEX
PDFDoc
PDFDocInfo
PDFDocViewPrefs
PDFDraw
PDFNet
PDFRasterizer
PDFView
PDFViewCtrl
Point
PolygonAnnot
PolyLineAnnot
PopupAnnot
PrinterMode
ProgressMonitor
PushButtonWidget
QuadPoint
RadioButtonGroup
RadioButtonWidget
Rect
Redaction
RedactionAnnot
RedactionAppearance
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
UnderlineAnnot
UndoManager
ViewChangeCollection
WatermarkAnnot
WidgetAnnot

Methods


<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".
Parameters:
Name Type Argument Default Description
optionsObj Object <optional>
{} [optionsObj.allowMultipleInstances=false] If allowMultipleInstances set to true, multiple instances of beginOperation will be allowed.

<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.

<static> displayAllocatedObjects()

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

<static> endDeallocateStack()

Deallocates all objects in memory that were created after the most recent startDeallocateStack call.

<static> finishOperation()

finishOperation releases the lock on all Emscripten worker operations on PDFNet. Will do nothing if PDFNet.beginOperation has not been called earlier.

<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> pdfGetDownloadedByteCount(doc)

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

<static> pdfGetTotalRemoteByteCount(doc)

Parameters:
Name Type Description
doc PDFNet.PDFDoc
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 Description
generator object The generator object function to execute.
license_key string the license key used to initialize PDFNet.
Returns:
a promise that resolves to the return value of the generator.

<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 Description
generator object The generator object function to execute.
license_key string the license key used to initialize PDFNet.
Returns:
a promise that resolves to the return value of the generator.

<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 Description
callback function A callback function to execute
license_key string the license key used to initialize PDFNet.
Returns:
a promise that resolves to the return value (if there is one) of the input function

<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 Description
callback function A callback function to execute
license_key string the license key used to initialize PDFNet.
Returns:
a promise that resolves to the return value (if there is one) of the input function

<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().