Module document.koptinterface

Interface to k2pdfoptlib backend.

Functions

KoptInterface:createContext (doc, pageno, bbox) Get reflow context.
KoptInterface:getAutoBBox (doc, pageno) Auto detect bbox.
KoptInterface:getSemiAutoBBox (doc, pageno) Detect bbox within user restricted bbox.
KoptInterface:getCachedContext (doc, pageno) Get cached koptcontext for a certain page.
KoptInterface:getPageDimensions (doc, pageno, zoom, rotation) Get page dimensions.
KoptInterface:getRFPageDimensions (doc, pageno, zoom, rotation) Get reflowed page dimensions.
KoptInterface:getCoverPageImage (doc) Get first page image.
KoptInterface:renderReflowedPage (doc, pageno, rect, zoom, rotation, render_mode) Render reflowed page into tile cache.
KoptInterface:renderOptimizedPage (doc, pageno, rect, zoom, rotation, render_mode) Render optimized page into tile cache.
KoptInterface:hintReflowedPage (doc, pageno, zoom, rotation, gamma, render_mode) Render reflowed page into cache in background thread.
KoptInterface:drawContextPage (doc, target, x, y, rect, pageno, zoom, rotation, render_mode) Draw cached tile pixels into target blitbuffer.
KoptInterface:getReflowedTextBoxes (doc, pageno) Get text boxes in reflowed page via rectmaps in koptcontext.
KoptInterface:getNativeTextBoxes (doc, pageno) Get text boxes in native page via rectmaps in koptcontext.
KoptInterface:getReflowedTextBoxesFromScratch (doc, pageno) Get text boxes in reflowed page via optical method.
KoptInterface:getNativeTextBoxesFromScratch (doc, pageno) Get text boxes in native page via optical method.
KoptInterface:getPageBlock (doc, pageno, x, y) Get page regions in native page via optical method.
KoptInterface:getOCRWord (doc, pageno, wbox) Get word from OCR providing selected word box.
KoptInterface:getReflewOCRWord (doc, pageno, rect) Get word from OCR in reflew page.
KoptInterface:getNativeOCRWord (doc, pageno, rect) Get word from OCR in native page.
KoptInterface:getOCRText (doc, pageno, tboxes) Get text from OCR providing selected text boxes.
KoptInterface:getWordFromBoxes (boxes, pos) Get word and word box around pos.
KoptInterface:getTextFromBoxes (boxes, pos0, pos1) Get text and text boxes between pos0 and pos1.
KoptInterface:getWordFromPosition (doc, pos) Get word and word box from doc position.
KoptInterface:getWordFromReflowPosition (doc, boxes, pos) Get word and word box from position in reflowed page.
KoptInterface:getWordFromNativePosition (doc, boxes, pos) Get word and word box from position in native page.
KoptInterface:getLinkFromPosition (doc, pageno, pos) Get link from position in screen page.
KoptInterface:nativeToReflowPosTransform (doc, pageno, pos) Transform position in native page to reflowed page.
KoptInterface:reflowToNativePosTransform (doc, pageno, abs_pos, rel_pos) Transform position in reflowed page to native page.
KoptInterface:getTextFromPositions (doc, pos0, pos1) Get text and text boxes from screen positions.
KoptInterface:getTextFromReflowPositions (doc, native_boxes, pos0, pos1) Get text and text boxes from screen positions for reflowed page.
KoptInterface:getTextFromNativePositions (doc, native_boxes, pos0, pos1) Get text and text boxes from screen positions for native page.
KoptInterface:getPageBoxesFromPositions (doc, pageno, ppos0, ppos1) Get text boxes from page positions.
KoptInterface:nativeToPageRectTransform (doc, pageno, rect) Get page rect from native rect.
KoptInterface:logReflowDuration (pageno, dur) Log reflow duration.


Functions

KoptInterface:createContext (doc, pageno, bbox)
Get reflow context.

Parameters:

  • doc
  • pageno
  • bbox Now koptcontext keeps track of its dst bitmap reflowed by libk2pdfopt. So there is no need to check background context when creating new context.
KoptInterface:getAutoBBox (doc, pageno)
Auto detect bbox.

Parameters:

  • doc
  • pageno
KoptInterface:getSemiAutoBBox (doc, pageno)
Detect bbox within user restricted bbox.

Parameters:

  • doc
  • pageno use manual bbox
KoptInterface:getCachedContext (doc, pageno)
Get cached koptcontext for a certain page.

If the context doesn't exist in cache, make a new context and reflow the src page immediately, or wait for the background thread with reflowed context.

Parameters:

  • doc
  • pageno
KoptInterface:getPageDimensions (doc, pageno, zoom, rotation)
Get page dimensions.

Parameters:

  • doc
  • pageno
  • zoom
  • rotation
KoptInterface:getRFPageDimensions (doc, pageno, zoom, rotation)
Get reflowed page dimensions.

Parameters:

  • doc
  • pageno
  • zoom
  • rotation
KoptInterface:getCoverPageImage (doc)
Get first page image.

Parameters:

  • doc
KoptInterface:renderReflowedPage (doc, pageno, rect, zoom, rotation, render_mode)
Render reflowed page into tile cache.

Inherited from common document interface.

Parameters:

  • doc
  • pageno
  • rect
  • zoom
  • rotation
  • render_mode
KoptInterface:renderOptimizedPage (doc, pageno, rect, zoom, rotation, render_mode)
Render optimized page into tile cache.

Inherited from common document interface.

Parameters:

  • doc
  • pageno
  • rect
  • zoom
  • rotation
  • render_mode
KoptInterface:hintReflowedPage (doc, pageno, zoom, rotation, gamma, render_mode)
Render reflowed page into cache in background thread.

This method returns immediately, leaving the precache flag on in context. Subsequent usage of this context should wait for the precache flag off by calling self:waitForContext(kctx)

Inherited from common document interface.

Parameters:

  • doc
  • pageno
  • zoom
  • rotation
  • gamma
  • render_mode
KoptInterface:drawContextPage (doc, target, x, y, rect, pageno, zoom, rotation, render_mode)
Draw cached tile pixels into target blitbuffer.

Inherited from common document interface.

Parameters:

  • doc
  • target
  • x
  • y
  • rect
  • pageno
  • zoom
  • rotation
  • render_mode
KoptInterface:getReflowedTextBoxes (doc, pageno)
Get text boxes in reflowed page via rectmaps in koptcontext.

Parameters:

  • doc
  • pageno
KoptInterface:getNativeTextBoxes (doc, pageno)
Get text boxes in native page via rectmaps in koptcontext.

Parameters:

  • doc
  • pageno
KoptInterface:getReflowedTextBoxesFromScratch (doc, pageno)
Get text boxes in reflowed page via optical method.

Done by OCR pre-processing in Tesseract and Leptonica.

Parameters:

  • doc
  • pageno
KoptInterface:getNativeTextBoxesFromScratch (doc, pageno)
Get text boxes in native page via optical method.

Done by OCR pre-processing in Tesseract and Leptonica.

Parameters:

  • doc
  • pageno
KoptInterface:getPageBlock (doc, pageno, x, y)
Get page regions in native page via optical method.

Parameters:

  • doc
  • pageno
  • x
  • y
KoptInterface:getOCRWord (doc, pageno, wbox)
Get word from OCR providing selected word box.

Parameters:

  • doc
  • pageno
  • wbox
KoptInterface:getReflewOCRWord (doc, pageno, rect)
Get word from OCR in reflew page.

Parameters:

  • doc
  • pageno
  • rect
KoptInterface:getNativeOCRWord (doc, pageno, rect)
Get word from OCR in native page.

Parameters:

  • doc
  • pageno
  • rect
KoptInterface:getOCRText (doc, pageno, tboxes)
Get text from OCR providing selected text boxes.

Parameters:

  • doc
  • pageno
  • tboxes
KoptInterface:getWordFromBoxes (boxes, pos)
Get word and word box around pos.

Parameters:

  • boxes
  • pos
KoptInterface:getTextFromBoxes (boxes, pos0, pos1)
Get text and text boxes between pos0 and pos1.

Parameters:

  • boxes
  • pos0
  • pos1
KoptInterface:getWordFromPosition (doc, pos)
Get word and word box from doc position.

Parameters:

  • doc
  • pos
KoptInterface:getWordFromReflowPosition (doc, boxes, pos)
Get word and word box from position in reflowed page.

Parameters:

  • doc
  • boxes
  • pos
KoptInterface:getWordFromNativePosition (doc, boxes, pos)
Get word and word box from position in native page.

Parameters:

  • doc
  • boxes
  • pos
KoptInterface:getLinkFromPosition (doc, pageno, pos)
Get link from position in screen page.

Parameters:

  • doc
  • pageno
  • pos
KoptInterface:nativeToReflowPosTransform (doc, pageno, pos)
Transform position in native page to reflowed page.

Parameters:

  • doc
  • pageno
  • pos
KoptInterface:reflowToNativePosTransform (doc, pageno, abs_pos, rel_pos)
Transform position in reflowed page to native page.

Parameters:

  • doc
  • pageno
  • abs_pos
  • rel_pos
KoptInterface:getTextFromPositions (doc, pos0, pos1)
Get text and text boxes from screen positions.

Parameters:

  • doc
  • pos0
  • pos1
KoptInterface:getTextFromReflowPositions (doc, native_boxes, pos0, pos1)
Get text and text boxes from screen positions for reflowed page.

Parameters:

  • doc
  • native_boxes
  • pos0
  • pos1
KoptInterface:getTextFromNativePositions (doc, native_boxes, pos0, pos1)
Get text and text boxes from screen positions for native page.

Parameters:

  • doc
  • native_boxes
  • pos0
  • pos1
KoptInterface:getPageBoxesFromPositions (doc, pageno, ppos0, ppos1)
Get text boxes from page positions.

Parameters:

  • doc
  • pageno
  • ppos0
  • ppos1
KoptInterface:nativeToPageRectTransform (doc, pageno, rect)
Get page rect from native rect.

Parameters:

  • doc
  • pageno
  • rect
KoptInterface:logReflowDuration (pageno, dur)
Log reflow duration.

Parameters:

  • pageno
  • dur
generated by LDoc 1.4.6 Last updated 2019-11-14 14:03:21