nv-file-pdf-shared-util
v0.0.3
Published
nv-file-pdf-shared-util ============ - nv-file-pdf-shared-util - all functions are from: - https://github.com/mozilla/pdf.js/blob/afb8c4fd25acf3a95828ed80ee3a904e07afd645/src/core/core_utils.js - https://github.com/mozilla/pdf.js/tree/afb8c4fd25acf3a9582
Downloads
5
Readme
nv-file-pdf-shared-util
nv-file-pdf-shared-util
all functions are from:
https://github.com/mozilla/pdf.js/blob/afb8c4fd25acf3a95828ed80ee3a904e07afd645/src/core/core_utils.js
https://github.com/mozilla/pdf.js/tree/afb8c4fd25acf3a95828ed80ee3a904e07afd645/src/shared
for reusing n another project
install
- npm install nv-file-pdf-shared-util
usage
example
APIS
{
consts: {
IDENTITY_MATRIX: [ 1, 0, 0, 1, 0, 0 ],
FONT_IDENTITY_MATRIX: [ 0.001, 0, 0, 0.001, 0, 0 ],
RenderingIntentFlag: {
ANY: 1,
DISPLAY: 2,
PRINT: 4,
ANNOTATIONS_FORMS: 16,
ANNOTATIONS_STORAGE: 32,
ANNOTATIONS_DISABLE: 64,
OPLIST: 256
},
AnnotationMode: { DISABLE: 0, ENABLE: 1, ENABLE_FORMS: 2, ENABLE_STORAGE: 3 },
PermissionFlag: {
PRINT: 4,
MODIFY_CONTENTS: 8,
COPY: 16,
MODIFY_ANNOTATIONS: 32,
FILL_INTERACTIVE_FORMS: 256,
COPY_FOR_ACCESSIBILITY: 512,
ASSEMBLE: 1024,
PRINT_HIGH_QUALITY: 2048
},
TextRenderingMode: {
FILL: 0,
STROKE: 1,
FILL_STROKE: 2,
INVISIBLE: 3,
FILL_ADD_TO_PATH: 4,
STROKE_ADD_TO_PATH: 5,
FILL_STROKE_ADD_TO_PATH: 6,
ADD_TO_PATH: 7,
FILL_STROKE_MASK: 3,
ADD_TO_PATH_FLAG: 4
},
ImageKind: { GRAYSCALE_1BPP: 1, RGB_24BPP: 2, RGBA_32BPP: 3 },
AnnotationType: {
TEXT: 1,
LINK: 2,
FREETEXT: 3,
LINE: 4,
SQUARE: 5,
CIRCLE: 6,
POLYGON: 7,
POLYLINE: 8,
HIGHLIGHT: 9,
UNDERLINE: 10,
SQUIGGLY: 11,
STRIKEOUT: 12,
STAMP: 13,
CARET: 14,
INK: 15,
POPUP: 16,
FILEATTACHMENT: 17,
SOUND: 18,
MOVIE: 19,
WIDGET: 20,
SCREEN: 21,
PRINTERMARK: 22,
TRAPNET: 23,
WATERMARK: 24,
THREED: 25,
REDACT: 26
},
AnnotationStateModelType: { MARKED: 'Marked', REVIEW: 'Review' },
AnnotationMarkedState: { MARKED: 'Marked', UNMARKED: 'Unmarked' },
AnnotationReviewState: {
ACCEPTED: 'Accepted',
REJECTED: 'Rejected',
CANCELLED: 'Cancelled',
COMPLETED: 'Completed',
NONE: 'None'
},
AnnotationReplyType: { GROUP: 'Group', REPLY: 'R' },
AnnotationFlag: {
INVISIBLE: 1,
HIDDEN: 2,
PRINT: 4,
NOZOOM: 8,
NOROTATE: 16,
NOVIEW: 32,
READONLY: 64,
LOCKED: 128,
TOGGLENOVIEW: 256,
LOCKEDCONTENTS: 512
},
AnnotationFieldFlag: {
READONLY: 1,
REQUIRED: 2,
NOEXPORT: 4,
MULTILINE: 4096,
PASSWORD: 8192,
NOTOGGLETOOFF: 16384,
RADIO: 32768,
PUSHBUTTON: 65536,
COMBO: 131072,
EDIT: 262144,
SORT: 524288,
FILESELECT: 1048576,
MULTISELECT: 2097152,
DONOTSPELLCHECK: 4194304,
DONOTSCROLL: 8388608,
COMB: 16777216,
RICHTEXT: 33554432,
RADIOSINUNISON: 33554432,
COMMITONSELCHANGE: 67108864
},
AnnotationBorderStyleType: { SOLID: 1, DASHED: 2, BEVELED: 3, INSET: 4, UNDERLINE: 5 },
AnnotationActionEventType: {
E: 'Mouse Enter',
X: 'Mouse Exit',
D: 'Mouse Down',
U: 'Mouse Up',
Fo: 'Focus',
Bl: 'Blur',
PO: 'PageOpen',
PC: 'PageClose',
PV: 'PageVisible',
PI: 'PageInvisible',
K: 'Keystroke',
F: 'Format',
V: 'Validate',
C: 'Calculate'
},
DocumentActionEventType: {
WC: 'WillClose',
WS: 'WillSave',
DS: 'DidSave',
WP: 'WillPrint',
DP: 'DidPrint'
},
PageActionEventType: { O: 'PageOpen', C: 'PageClose' },
StreamType: {
UNKNOWN: 'UNKNOWN',
FLATE: 'FLATE',
LZW: 'LZW',
DCT: 'DCT',
JPX: 'JPX',
JBIG: 'JBIG',
A85: 'A85',
AHX: 'AHX',
CCF: 'CCF',
RLX: 'RLX'
},
FontType: {
UNKNOWN: 'UNKNOWN',
TYPE1: 'TYPE1',
TYPE1STANDARD: 'TYPE1STANDARD',
TYPE1C: 'TYPE1C',
CIDFONTTYPE0: 'CIDFONTTYPE0',
CIDFONTTYPE0C: 'CIDFONTTYPE0C',
TRUETYPE: 'TRUETYPE',
CIDFONTTYPE2: 'CIDFONTTYPE2',
TYPE3: 'TYPE3',
OPENTYPE: 'OPENTYPE',
TYPE0: 'TYPE0',
MMTYPE1: 'MMTYPE1'
},
CMapCompressionType: { NONE: 0, BINARY: 1, STREAM: 2 },
OPS: {
dependency: 1,
setLineWidth: 2,
setLineCap: 3,
setLineJoin: 4,
setMiterLimit: 5,
setDash: 6,
setRenderingIntent: 7,
setFlatness: 8,
setGState: 9,
save: 10,
restore: 11,
transform: 12,
moveTo: 13,
lineTo: 14,
curveTo: 15,
curveTo2: 16,
curveTo3: 17,
closePath: 18,
rectangle: 19,
stroke: 20,
closeStroke: 21,
fill: 22,
eoFill: 23,
fillStroke: 24,
eoFillStroke: 25,
closeFillStroke: 26,
closeEOFillStroke: 27,
endPath: 28,
clip: 29,
eoClip: 30,
beginText: 31,
endText: 32,
setCharSpacing: 33,
setWordSpacing: 34,
setHScale: 35,
setLeading: 36,
setFont: 37,
setTextRenderingMode: 38,
setTextRise: 39,
moveText: 40,
setLeadingMoveText: 41,
setTextMatrix: 42,
nextLine: 43,
showText: 44,
showSpacedText: 45,
nextLineShowText: 46,
nextLineSetSpacingShowText: 47,
setCharWidth: 48,
setCharWidthAndBounds: 49,
setStrokeColorSpace: 50,
setFillColorSpace: 51,
setStrokeColor: 52,
setStrokeColorN: 53,
setFillColor: 54,
setFillColorN: 55,
setStrokeGray: 56,
setFillGray: 57,
setStrokeRGBColor: 58,
setFillRGBColor: 59,
setStrokeCMYKColor: 60,
setFillCMYKColor: 61,
shadingFill: 62,
beginInlineImage: 63,
beginImageData: 64,
endInlineImage: 65,
paintXObject: 66,
markPoint: 67,
markPointProps: 68,
beginMarkedContent: 69,
beginMarkedContentProps: 70,
endMarkedContent: 71,
beginCompat: 72,
endCompat: 73,
paintFormXObjectBegin: 74,
paintFormXObjectEnd: 75,
beginGroup: 76,
endGroup: 77,
beginAnnotations: 78,
endAnnotations: 79,
beginAnnotation: 80,
endAnnotation: 81,
paintJpegXObject: 82,
paintImageMaskXObject: 83,
paintImageMaskXObjectGroup: 84,
paintImageXObject: 85,
paintInlineImageXObject: 86,
paintInlineImageXObjectGroup: 87,
paintImageXObjectRepeat: 88,
paintImageMaskXObjectRepeat: 89,
paintSolidColorImageMask: 90,
constructPath: 91
},
UNSUPPORTED_FEATURES: {
unknown: 'unknown',
forms: 'forms',
javaScript: 'javaScript',
signatures: 'signatures',
smask: 'smask',
shadingPattern: 'shadingPattern',
font: 'font',
errorTilingPattern: 'errorTilingPattern',
errorExtGState: 'errorExtGState',
errorXObject: 'errorXObject',
errorFontLoadType3: 'errorFontLoadType3',
errorFontState: 'errorFontState',
errorFontMissing: 'errorFontMissing',
errorFontTranslate: 'errorFontTranslate',
errorColorSpace: 'errorColorSpace',
errorOperatorList: 'errorOperatorList',
errorFontToUnicode: 'errorFontToUnicode',
errorFontLoadNative: 'errorFontLoadNative',
errorFontBuildPath: 'errorFontBuildPath',
errorFontGetPath: 'errorFontGetPath',
errorMarkedContent: 'errorMarkedContent',
errorContentSubStream: 'errorContentSubStream'
},
PasswordResponses: { NEED_PASSWORD: 1, INCORRECT_PASSWORD: 2 },
XMLEntities: {
'34': '"',
'38': '&',
'39': ''',
'60': '<',
'62': '>'
}
},
env: {
is_node: [Function: is_node],
btoa: [Function: btoa],
atob: [Function: atob],
createObjectURL: [Function: createObjectURL],
patch_global_this: [Function: patch_global_this],
IsLittleEndianCached: { value: [Getter] },
isEvalSupported: [Function: isEvalSupported],
IsEvalSupportedCached: { value: [Getter] }
},
date: { getModificationDate: [Function: getModificationDate] },
is: {
isBool: [Function: isBool],
isNum: [Function: isNum],
isString: [Function: isString],
isArrayBuffer: [Function: isArrayBuffer],
isArrayEqual: [Function: isArrayEqual]
},
str: {
PDFStringTranslateTable: [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
728, 711, 710, 729, 733, 731, 730, 732, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
... 61 more items
],
stringToPDFString: [Function: stringToPDFString],
escapeString: [Function: escapeString],
escapePDFName: [Function: escapePDFName],
XMLEntities: {
'34': '"',
'38': '&',
'39': ''',
'60': '<',
'62': '>'
}
},
transform: [class Util],
capability: {
shadow: [Function: shadow],
createPromiseCapability: [Function: createPromiseCapability]
},
clr: [class ColorConverters],
err: {
BaseException: <ref *1> [Function: BaseException] {
constructor: [Circular *1]
},
PasswordException: [class PasswordException extends BaseException],
UnknownErrorException: [class UnknownErrorException extends BaseException],
InvalidPDFException: [class InvalidPDFException extends BaseException],
MissingPDFException: [class MissingPDFException extends BaseException],
UnexpectedResponseException: [class UnexpectedResponseException extends BaseException],
FormatError: [class FormatError extends BaseException],
AbortException: [class AbortException extends BaseException],
MissingDataException: [class MissingDataException extends BaseException],
ParserEOFException: [class ParserEOFException extends BaseException],
XRefEntryException: [class XRefEntryException extends BaseException],
XRefParseException: [class XRefParseException extends BaseException]
},
cff: {
CFFEncodingMap: {
'0': '-reserved-',
'1': 'hstem',
'2': '-reserved-',
'3': 'vstem',
'4': 'vmoveto',
'5': 'rlineto',
'6': 'hlineto',
'7': 'vlineto',
'8': 'rrcurveto',
'9': '-reserved-',
'10': 'callsubr',
'11': 'return',
'12': [Object],
'13': '-reserved-',
'14': 'endchar',
'15': '-reserved-',
'16': '-reserved-',
'17': '-reserved-',
'18': 'hstemhm',
'19': 'hintmask',
'20': 'cntrmask',
'21': 'rmoveto',
'22': 'hmoveto',
'23': 'vstemhm',
'24': 'rcurveline',
'25': 'rlivecurve',
'26': 'vvcurveto',
'27': 'hhcurveto',
'29': 'callgsubr',
'30': 'vhcurveto',
'31': 'hvcurveto'
},
CFFDictDataMap: {
'0': [Object],
'1': [Object],
'2': [Object],
'3': [Object],
'4': [Object],
'5': [Object],
'6': [Object],
'7': [Object],
'8': [Object],
'9': [Object],
'10': [Object],
'11': [Object],
'12': [Object],
'13': [Object],
'14': [Object],
'15': [Object],
'16': [Object],
'17': [Object],
'18': [Object],
'19': [Object],
'20': [Object],
'21': [Object]
},
CFFDictPrivateDataMap: {
'6': [Object],
'7': [Object],
'8': [Object],
'9': [Object],
'10': [Object],
'11': [Object],
'12': [Object],
'19': [Object],
'20': [Object],
'21': [Object]
}
},
stream: {
BaseStream: [class BaseStream],
NullStream: [class NullStream extends Stream],
StringStream: [class StringStream extends Stream],
Stream: [class Stream extends BaseStream]
},
primitives: {
clearPrimitiveCaches: [Function: clearPrimitiveCaches],
Cmd: [class Cmd],
Dict: [class Dict],
EOF: Symbol(EOF),
isCmd: [Function: isCmd],
isDict: [Function: isDict],
isName: [Function: isName],
isRef: [Function: isRef],
isRefsEqual: [Function: isRefsEqual],
isStream: [Function: isStream],
Name: [class Name],
Ref: [class Ref],
RefSet: [class RefSet],
RefSetCache: [class RefSetCache],
getLookupTableFactory: [Function: getLookupTableFactory],
getArrayLookupTableFactory: [Function: getArrayLookupTableFactory],
getInheritableProperty: [Function: getInheritableProperty],
_collectJS: [Function: _collectJS],
collectActions: [Function: collectActions]
},
xfa: { parseXFAPath: [Function: parseXFAPath] },
math: { log2: [Function: log2] },
num: {
ROMAN_NUMBER_MAP: [
'', 'C', 'CC', 'CCC', 'CD',
'D', 'DC', 'DCC', 'DCCC', 'CM',
'', 'X', 'XX', 'XXX', 'XL',
'L', 'LX', 'LXX', 'LXXX', 'XC',
'', 'I', 'II', 'III', 'IV',
'V', 'VI', 'VII', 'VIII', 'IX'
],
toRomanNumerals: [Function: toRomanNumerals]
},
bytes: {
NullCharactersRegExp: /\x00/g,
removeNullCharacters: [Function: removeNullCharacters],
bytesToString: [Function: bytesToString],
stringToBytes: [Function: stringToBytes],
arrayByteLength: [Function: arrayByteLength],
arraysToBytes: [Function: arraysToBytes],
string32: [Function: string32],
isLittleEndian: [Function: isLittleEndian],
hexNumbers: [
'00', '01', '02', '03', '04', '05', '06', '07', '08', '09',
'0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13',
'14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d',
'1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27',
'28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31',
'32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b',
'3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45',
'46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f',
'50', '51', '52', '53', '54', '55', '56', '57', '58', '59',
'5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63',
... 156 more items
],
isAscii: [Function: isAscii],
stringToUTF16BEString: [Function: stringToUTF16BEString],
stringToUTF8String: [Function: stringToUTF8String],
utf8StringToString: [Function: utf8StringToString]
},
url: {
isSameOrigin: [Function (anonymous)],
_isValidProtocol: [Function (anonymous)],
createValidAbsoluteUrl: [Function (anonymous)]
},
log: {
VerbosityLevel: { ERRORS: 0, WARNINGS: 1, INFOS: 5 },
setVerbosityLevel: [Function: setVerbosityLevel],
setVerbosityLevelError: [Function: setVerbosityLevelError],
setVerbosityLevelWarning: [Function: setVerbosityLevelWarning],
setVerbosityLevelInfo: [Function: setVerbosityLevelInfo],
getVerbosityLevel: [Function: getVerbosityLevel],
info: [Function: info],
warn: [Function: warn],
unreachable: [Function: unreachable],
assert: [Function: assert],
show: [Function: show],
paint_ansi8: [Function: paint_ansi8],
paint_ansi8_underscore: [Function: paint_ansi8_underscore],
paint_ansi256: [Function: paint_ansi256],
log_ansi8: [Function: log_ansi8],
log_ansi8_undersore: [Function: log_ansi8_undersore],
log_ansi256: [Function: log_ansi256]
}
}
LICENSE
- ISC