Namespace: PDFNet

PDFNet

Contains PDFNetJS classes and functions

Classes

Action
ActionParameter
Annot
AnnotBorderStyle
AppearanceReferenceList
AttrObj
Bookmark
CaretAnnot
ChunkRenderer
CircleAnnot
ClassMap
ColorPt
ColorSpace
ContentItem
ContentReplacer
ConversionMonitor
Date
Destination
DictIterator
DocumentConversion
Element
ElementBuilder
ElementReader
ElementWriter
FDFDoc
FDFField
Field
FileAttachmentAnnot
FileSpec
Filter
FilterReader
FilterWriter
Flattener
Font
FreeTextAnnot
Function
GeometryCollection
GState
HighlightAnnot
Highlights
HTML2PDF
HTML2PDF_Proxy
HTML2PDF_TOCSettings
HTML2PDF_WebPageSettings
Image
InkAnnot
Iterator
KeyStrokeActionResult
KeyStrokeEventData
LineAnnot
LinkAnnot
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
ProgressMonitor
QuadPoint
Rect
Redaction
RedactionAnnot
RedactionAppearance
Redactor
RoleMap
RubberStampAnnot
ScreenAnnot
SDFDoc
SecurityHandler
SElement
Shading
SignatureHandler
SoundAnnot
SquareAnnot
SquigglyAnnot
Stamper
STree
StrikeOutAnnot
TextAnnot
TextExtractor
TextExtractorLine
TextExtractorStyle
TextExtractorWord
TextMarkupAnnot
TextSearch
UnderlineAnnot
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".

var optionsObj = {};
optionsObj.allowMultipleInstances = true;
yield PDFNet.beginOperation(optionsObj);
Parameters:
Name Type Argument Default Description
optionsObj obj <optional>
{}

[optionsObj.allowMultipleInstances=false] If allowMultipleInstances set to true, multiple instances of beginOperation will be allowed.


<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> getFullMessage(e)

Parameters:
Name Type Description
e

<static> getNormalizedUrl(url)

Parameters:
Name Type Description
url string
Returns:

A promise that resolves to an object of type: "string"

Type
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
Number

<static> pdfGetDownloadedByteCount(doc)

Parameters:
Name Type Description
doc PDFNet.PDFDoc
Returns:

A promise that resolves to an object of type: "number"

Type
number

<static> pdfGetTotalRemoteByteCount(doc)

Parameters:
Name Type Description
doc PDFNet.PDFDoc
Returns:

A promise that resolves to an object of type: "number"

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