Skip to content

pdf.js (deprecated)

noitsnotme edited this page Nov 29, 2016 · 1 revision

Viewer.html

할 일

  • web/viewer.html & web/viewer.js을 뜯어보고 분석하면서 얻어지는 것들 기록
  • 중간에 감이 오면 자유롭게 곁가지를 칩시다.

논의


viewer.html 에서 해당 코드는 viewer.js 를 include 한다.

<script src="viewer.js"></script> 

툴바에 있는 버튼 정보:

<button id="aaa" class="bbb" title="ccc" tabindex="dd" data-l10n-id="eee"></button>

class 는 style 을 일괄적으로 적용시키기 위한 묶음이다. title 은 마우스오버를 했을시 뜨는 텍스트다. tabindex 는 tab했을때 넘어가는 순서를 나타낸다. data-l10n-id 는 custom attribute 이며, external/webL10n/l10n.js 의 getL10nAtrributes() 에서 이걸 가져다가 json으로 만들거나, getTranslatablChilderen() 에서 해당 attribute 의 값을 가져다가 리스트로 가져오는 식으로 활용한다.


pdf.js/src/core/annotation.js "주석 정의하기"

  • annotation 모듈이 놀랍게도 존재(어불성설)
    • AnnotationFactory() 함수
    • Annotation 오브젝트
    • 각 종 annotation 오브젝트들
  • AnnotationFactory
    • AnnotationFactory.create(xref, ref, pdfManager, uniquePrefix, idCounters) --> Annotation 오브젝트를 리턴
  • Annotation
    • properties를 data object를 통해 expose
      • data.id
      • data.subtype
        • Link, Text, Highlight, ...
      • data.annotationFlags // Unsigned 32-bit integer specifying annotation characteristics
      • data.rect
      • data.color
      • data.borderStyle
      • data.hasAppearance
  • HighlightAnnotation

pdf.js/src/shared/util.js

  • 각종 공유 변수 및 함수 등이 저장됨
  • annotation 관련
    • AnnotationType
      • TEXT: 1
      • HIGHLIGHT: 9
      • ...
    • AnnotationFlag
      • INVISIBLE: 0x01
      • HIDDEN: 0x02
      • ...
    • AnnotationFieldFlag
    • AnnotationBorderStyleType
  • 일반 util
    • inherit(sub, base, prototype) 함수
      • sub에 base의 prototype을 inherit 함 (javascript의 개념)

blahblah

Clone this wiki locally