Contains PDFNetJS classes and functions
Classes
- Action
- ActionParameter
- Annot
- AnnotBorderStyle
- AttrObj
- Bookmark
- ByteRange
- CaretAnnot
- CharData
- CheckBoxWidget
- ChunkRenderer
- CircleAnnot
- ClassMap
- ColorPt
- ColorSpace
- ComboBoxWidget
- ContentItem
- ContentReplacer
- ConversionMonitor
- Convert
- Date
- Destination
- Destroyable
- DictIterator
- DigestAlgorithm
- DigitalSignatureField
- DisallowedChange
- DocSnapshot
- Element
- ElementBuilder
- ElementReader
- ElementWriter
- EmbeddedTimestampVerificationResult
- FDFDoc
- FDFField
- Field
- FileAttachmentAnnot
- FileSpec
- Filter
- FilterReader
- FilterWriter
- Flattener
- Font
- FreeTextAnnot
- Function
- GeometryCollection
- GState
- HighlightAnnot
- Highlights
- Image
- InkAnnot
- Iterator
- KeyStrokeActionResult
- KeyStrokeEventData
- LineAnnot
- LinkAnnot
- ListBoxWidget
- MarkupAnnot
- Matrix2D
- MovieAnnot
- NameTree
- NumberTree
- Obj
- ObjectIdentifier
- ObjSet
- OCG
- OCGConfig
- OCGContext
- OCMD
- OCRModule
- Optimizer
- OwnedBitmap
- Page
- PageLabel
- PageSet
- PatternColor
- PDFACompliance
- PDFDC
- PDFDCEX
- PDFDoc
- PDFDocInfo
- PDFDocViewPrefs
- PDFDraw
- PDFRasterizer
- PDFTronCustomSecurityHandler
- Point
- PolygonAnnot
- PolyLineAnnot
- PopupAnnot
- PrinterMode
- PushButtonWidget
- QuadPoint
- RadioButtonGroup
- RadioButtonWidget
- Rect
- Redaction
- RedactionAnnot
- Redactor
- Reflow
- ResultSnapshot
- RoleMap
- RubberStampAnnot
- ScreenAnnot
- SDFDoc
- SecurityHandler
- SElement
- Separation
- Shading
- ShapedText
- SignatureHandler
- SignatureWidget
- SoundAnnot
- SquareAnnot
- SquigglyAnnot
- Stamper
- STree
- StrikeOutAnnot
- TextAnnot
- TextExtractor
- TextExtractorLine
- TextExtractorStyle
- TextExtractorWord
- TextMarkupAnnot
- TextRange
- TextSearch
- TextWidget
- TimestampingConfiguration
- TimestampingResult
- TrustVerificationResult
- UnderlineAnnot
- UndoManager
- VerificationOptions
- VerificationResult
- ViewChangeCollection
- WatermarkAnnot
- WebFontDownloader
- WidgetAnnot
- X501AttributeTypeAndValue
- X501DistinguishedName
- X509Certificate
- X509Extension
Members
-
<static> CharacterOrdering
-
Type:
- number
Properties:
Name Type Description e_Identity
number e_Japan1
number e_Japan2
number e_GB1
number e_CNS1
number e_Korea1
number -
<static> CMSType
-
Type:
- number
Properties:
Name Type Description e_lcms
number e_icm
number e_no_cms
number -
<static> ConnectionErrorHandlingMode
-
Type:
- number
Properties:
Name Type Description e_continue
number e_continue_unless_switching_to_demo
number e_stop
number -
<static> LogLevel
-
Type:
- number
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> addPDFTronCustomHandler(custom_id)
-
Parameters:
Name Type Description custom_id
number 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".
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> convertPageToAnnotAppearance(docWithAppearance, objNum, annot_state, appearance_state)
-
Parameters:
Name Type Description docWithAppearance
Core.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc objNum
number annot_state
number PDFNet.Annot.State = { e_normal : 0 e_rollover : 1 e_down : 2 }
appearance_state
string Returns:
A promise that resolves to an unknown type -
<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.
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> getVersionString()
-
Returns:
A promise that resolves to an object of type: "string"- Type
- Promise.<string>
-
<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 "wasm-threads" to use threaded WebAssembly 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> rubberStampAnnotSetOpacity(stamp, opacity)
-
Parameters:
Name Type Description stamp
Core.PDFNet.Annot opacity
number Returns:
- Type
- Promise.<void>
-
<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 some PDFNet objects alive out of the scope of this generator function in which case takeOwnership should called on these objects. In case the user wishes to keep all the PDFNet objects alive, 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 all 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 some PDFNet objects alive out of the scope of this function in which case takeOwnership should called on these objects. In case the user wishes to keep all the PDFNet objects alive, 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- 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 all 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- 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> setConnectionErrorHandlingMode(mode)
-
Sets the connection error handling behaviour for PDFTron SDK The default for this method is e_continue
Parameters:
Name Type Description mode
number PDFNet.ConnectionErrorHandlingMode = { e_continue : 0 e_continue_unless_switching_to_demo : 1 e_stop : 2 }
Rules that PDFTron SDK will follow after a connection error.Returns:
- Type
- Promise.<void>
-
<static> setDefaultDeviceCMYKProfileFromFilter(stream)
-
sets the default ICC color profile for DeviceCMYK color space. Note: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual.
Parameters:
Name Type Description stream
Core.PDFNet.Filter Returns:
- Type
- Promise.<void>
-
<static> setDefaultDeviceRGBProfileFromFilter(stream)
-
sets the default ICC color profile for DeviceRGB color space. Note: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual.
Parameters:
Name Type Description stream
Core.PDFNet.Filter 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> setViewerCache(max_cache_size, on_disk)
-
Sets the default parameters for the viewer cache. Any subsequently created documents will use these parameters.
Parameters:
Name Type Description max_cache_size
number The maximum size, in bytes, of the entire document's page cache. Set to zero to disable the viewer cache. on_disk
boolean If set to 'true', cache will be stored on the local filesystem. If set to 'false', cache will be stored in heap memory. - Default Value:
-
- Desktop: max_cache_size = 512 MB, on_disk = true | Mobile: max_cache_size = 100 MB, on_disk = false
Returns:
- Type
- Promise.<void>
-
<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>
-
<static> terminateEx(termination_level)
-
terminates PDFNet library. Terminate() is usually called once, when the process is terminated.
Parameters:
Name Type Description termination_level
number Optional termination level used to decide what operations need to be included Note: it is unsafe to call any other PDFNet API after you terminate the library. Returns:
- Type
- Promise.<void>