const RenderingStates = { INITIAL: 0, RUNNING: 1, PAUSED: 2, FINISHED: 3 } const ALIGN = { 0: 'left', 1: 'center', 2: 'right' } const ALIGNMAP = { LEFT: 0, CENTER: 1, CENTERED: 1, RIGHT: 2 } const MARGIN_DISTANCE = 10 const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; // Represent the percentage of the height of a single-line field over // the font size. Acrobat seems to use this value. const LINE_FACTOR = 1.35; const LINE_DESCENT_FACTOR = 0.35; const MARKUP = ['highlight', 'underline', 'squiggly', 'strikeout'] /** * Refer to the `WorkerTransport.getRenderingIntent`-method in the API, to see * how these flags are being used: * - ANY, DISPLAY, and PRINT are the normal rendering intents, note the * `PDFPageProxy.{render, getOperatorList, getAnnotations}`-methods. * - ANNOTATIONS_FORMS, ANNOTATIONS_STORAGE, ANNOTATIONS_DISABLE control which * annotations are rendered onto the canvas (i.e. by being included in the * operatorList), note the `PDFPageProxy.{render, getOperatorList}`-methods * and their `annotationMode`-option. * - OPLIST is used with the `PDFPageProxy.getOperatorList`-method, note the * `OperatorList`-constructor (on the worker-thread). */ const RenderingIntentFlag = { ANY: 0x01, DISPLAY: 0x02, PRINT: 0x04, ANNOTATIONS_FORMS: 0x10, ANNOTATIONS_STORAGE: 0x20, ANNOTATIONS_DISABLE: 0x40, OPLIST: 0x100, }; const AnnotationEditorPrefix = "pdfjs_internal_editor_"; const AnnotationEditorType = { DISABLE: -1, NONE: 0, FREETEXT: 3, INK: 15, }; const AnnotationEditorParamsType = { FREETEXT_SIZE: 1, FREETEXT_COLOR: 2, FREETEXT_OPACITY: 3, INK_COLOR: 11, INK_THICKNESS: 12, INK_OPACITY: 13, }; // Permission flags from Table 22, Section 7.6.3.2 of the PDF specification. const PermissionFlag = { PRINT: 0x04, MODIFY_CONTENTS: 0x08, COPY: 0x10, MODIFY_ANNOTATIONS: 0x20, FILL_INTERACTIVE_FORMS: 0x100, COPY_FOR_ACCESSIBILITY: 0x200, ASSEMBLE: 0x400, PRINT_HIGH_QUALITY: 0x800, }; const 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, }; const ImageKind = { GRAYSCALE_1BPP: 1, RGB_24BPP: 2, RGBA_32BPP: 3, }; const 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, }; const AnnotationTypeString = { 1: 'text', 2: 'link', 3: 'freetext', 4: 'line', 5: 'square', 6: 'circle', 7: 'polygon', 8: 'polyline', 9: 'highlight', 10: 'underline', 11: 'squiggly', 12: 'strikeout', 13: 'stamp', 14: 'caret', 15: 'ink', 16: 'popup', 17: 'fileattachment', 18: 'sound', 19: 'movie', 20: 'widget', 21: 'screen', 22: 'printermark', 23: 'trapnet', 24: 'watermark', 25: 'threed', 26: 'redact', }; const WidgetType = { PUSHBUTTON: 0, CHECKBOX: 1, RADIOBUTTON: 2, TEXTFIELD: 3, COMBOBOX: 4, LISTBOX: 5, SIGNATUREFIELDS: 6, UNKNOWN: 0XFF } const WidgetTypeString = { 0: 'pushbutton', 1: 'checkbox', 2: 'radiobutton', 3: 'textfield', 4: 'combobox', 5: 'listbox', 6: 'signaturefields', 0xff: 'unknown', } const TextFiledSpecial = { normal: 0, date: 1 } const TextFiledSpecialString = { 0: 'normal', 1: 'date' } const AnnotationFlags = { AnnotationFlagInvisible: 1, // 1 AnnotationFlagHidden: 1 << 1, // 10 2 AnnotationFlagPrint: 1 << 2, // 100 4 AnnotationFlagNoZoom: 1 << 3, // 1000 8 AnnotationFlagNoRotate: 1 << 4, // 10000 16 AnnotationFlagNoView: 1 << 5, // 100000 32 AnnotationFlagReadOnly: 1 << 6, // 1000000 64 AnnotationFlagLocked: 1 << 7, // 10000000 128 AnnotationFlagToggleNoView: 1 << 8, // 100000000 256 AnnotationFlagLockedContents: 1 << 9, // 1000000000 512 }; const LineType = { UNKNOWN: -1, NONE: 0, OPENARROW: 1, CLOSEDARROW: 2, SQUARE: 3, CIRCLE: 4, DIAMOND: 5, BUTT: 6, ROPENARROW: 7, RCLOSEDARROW: 8, SLASH: 9, } const LineTypeString = { '-1': 'Unknown', 0: 'None', 1: 'OpenArrow', 2: 'closedarrow', 3: 'square', 4: 'circle', 5: 'diamond', 6: 'butt', 7: 'ropenarrow', 8: 'rclosedarrow', 9: 'slash', } const CheckStyle = { none: -1, check: 0, circle: 1, cross: 2, diamond: 3, square: 4, star: 5, } const CheckStyleString = { 1: 'none', 0: 'check', 1: 'circle', 2: 'cross', 3: 'diamond', 4: 'square', 5: 'star', } const StampType = { UNKNOWN: 0, STANDARD: 1, IMAGE: 2, TEXT: 3, DIGITAL: 4, } const StampTypeString = { 0: 'unknown', 1: 'standard', 2: 'image', 3: 'text', 4: 'digital', } const TextStampColor = { white: 0, red: 1, green: 2, blu: 3, } const TextStampColorString = { 0: 'white', 1: 'red', 2: 'green', 3: 'blu', } const ActionType = { Unknown: 0, GoTo: 1, GoToR: 2, GoToE: 3, Launch: 4, Thread: 5, URI: 6, Sound: 7, Movie: 8, Hide: 9, Named: 10, SubmitForm: 11, ResetForm: 12, ImportData: 13, JavaScript: 14, SetOCGState: 15, Rendition: 16, Trans: 17, GoTo3DView: 18, UOP: 19, //unlock uop Error: 0xff } const ActionTypeString = { 0: 'unknown', 1: 'goto', 2: 'gotor', 3: 'gotoe', 4: 'launch', 5: 'thread', 6: 'uri', 7: 'sound', 8: 'movie', 9: 'hide', 10: 'named', 11: 'submitform', 12: 'resetform', 13: 'importdata', 14: 'javascript', 15: 'setocgstate', 16: 'rendition', 17: 'trans', 18: 'goto3dview', 19: 'uop', 0xff: 'error', } const BorderStyleInt = { solid: 0, dashded: 1, beveled: 2, inset: 3, underline: 4, } const BorderStyleString = { 0: 'solid', 1: 'dashded', 2: 'beveled', 3: 'inset', 4: 'underline', } const TextStampShape = { rect: 0, leftTriangle: 1, rightTriangle: 2, none: 3, } const TextStampShapeString = { 0: 'rect', 1: 'leftTriangle', 2: 'rightTriangle', 3: 'none', } const AnnotationStateModelType = { MARKED: "Marked", REVIEW: "Review", }; const AnnotationMarkedState = { MARKED: "Marked", UNMARKED: "Unmarked", }; const AnnotationReviewState = { ACCEPTED: "Accepted", REJECTED: "Rejected", CANCELLED: "Cancelled", COMPLETED: "Completed", NONE: "None", }; const AnnotationReplyType = { GROUP: "Group", REPLY: "R", }; const AnnotationFlag = { INVISIBLE: 0x01, HIDDEN: 0x02, PRINT: 0x04, NOZOOM: 0x08, NOROTATE: 0x10, NOVIEW: 0x20, READONLY: 0x40, LOCKED: 0x80, TOGGLENOVIEW: 0x100, LOCKEDCONTENTS: 0x200, }; const AnnotationFieldFlag = { READONLY: 0x0000001, REQUIRED: 0x0000002, NOEXPORT: 0x0000004, MULTILINE: 0x0001000, PASSWORD: 0x0002000, NOTOGGLETOOFF: 0x0004000, RADIO: 0x0008000, PUSHBUTTON: 0x0010000, COMBO: 0x0020000, EDIT: 0x0040000, SORT: 0x0080000, FILESELECT: 0x0100000, MULTISELECT: 0x0200000, DONOTSPELLCHECK: 0x0400000, DONOTSCROLL: 0x0800000, COMB: 0x1000000, RICHTEXT: 0x2000000, RADIOSINUNISON: 0x2000000, COMMITONSELCHANGE: 0x4000000, }; const AnnotationBorderStyleType = { SOLID: 1, DASHED: 2, BEVELED: 3, INSET: 4, UNDERLINE: 5, }; const 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", }; const DocumentActionEventType = { WC: "WillClose", WS: "WillSave", DS: "DidSave", WP: "WillPrint", DP: "DidPrint", }; const PageActionEventType = { O: "PageOpen", C: "PageClose", }; const StreamType = { UNKNOWN: "UNKNOWN", FLATE: "FLATE", LZW: "LZW", DCT: "DCT", JPX: "JPX", JBIG: "JBIG", A85: "A85", AHX: "AHX", CCF: "CCF", RLX: "RLX", // PDF short name is 'RL', but telemetry requires three chars. }; const 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", }; const VerbosityLevel = { ERRORS: 0, WARNINGS: 1, INFOS: 5, }; const CMapCompressionType = { NONE: 0, BINARY: 1, }; // All the possible operations for an operator list. const OPS = { // Intentionally start from 1 so it is easy to spot bad operators that will be // 0's. // PLEASE NOTE: We purposely keep any removed operators commented out, since // re-numbering the list would risk breaking third-party users. 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, }; const UNSUPPORTED_FEATURES = { forms: "forms", javaScript: "javaScript", signatures: "signatures", smask: "smask", shadingPattern: "shadingPattern", 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", }; const PasswordResponses = { NEED_PASSWORD: 1, INCORRECT_PASSWORD: 2, }; class PixelsPerInch { static CSS = 96.0; static PDF = 72.0; static PDF_TO_CSS_UNITS = 1; } const ANNOTATION_TYPE = { ink: 'Ink', freetext: 'freetext', text: 'Text', square: 'Square', circle: 'Circle', line: 'Line', arrow: 'Line', image: 'Image', }; export { RenderingStates, MARGIN_DISTANCE, IDENTITY_MATRIX, FONT_IDENTITY_MATRIX, LINE_FACTOR, MARKUP, LINE_DESCENT_FACTOR, RenderingIntentFlag, AnnotationEditorPrefix, AnnotationEditorType, AnnotationEditorParamsType, PermissionFlag, TextRenderingMode, ImageKind, AnnotationType, AnnotationTypeString, WidgetType, WidgetTypeString, AnnotationFlags, TextFiledSpecial, TextFiledSpecialString, LineType, LineTypeString, CheckStyle, CheckStyleString, StampType, StampTypeString, TextStampColor, TextStampColorString, ActionType, ActionTypeString, BorderStyleInt, BorderStyleString, TextStampShape, TextStampShapeString, AnnotationStateModelType, AnnotationMarkedState, AnnotationReviewState, AnnotationReplyType, AnnotationFlag, AnnotationFieldFlag, AnnotationBorderStyleType, AnnotationActionEventType, DocumentActionEventType, PageActionEventType, StreamType, FontType, VerbosityLevel, CMapCompressionType, OPS, PixelsPerInch, UNSUPPORTED_FEATURES, PasswordResponses, ANNOTATION_TYPE, ALIGN, ALIGNMAP }