pdf.js (deprecated) - parkjunsoo91/letsread GitHub Wiki

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์˜ ๊ฐœ๋…)
โš ๏ธ **GitHub.com Fallback** โš ๏ธ