public PdfSourceRect GetRectOnUnrotatedPage(int start, int end) { end = Math.Min(end, glyphPositions.Length - 1); PdfSourceRect rect = rectOnUnrotatedPage.Clone(); rect.dX = glyphPositions[start]; rect.dWidth = glyphPositions[end] - glyphPositions[start]; return(rect); }
public PdfSourceRect RectOnCanvas(PdfSourceRect pageRect, PdfViewerController.Viewport viewport) { PdfSourceRect rect = viewport.Rectangle.GetSourceRect(viewport.ZoomFactor); double left = Double.IsNaN(this.left) ? rect.dX : (this.left + pageRect.dX); double top = (Double.IsNaN(this.top) || this.top == -32768) ? pageRect.dY : (pageRect.dBottom - this.top); double width = Double.IsNaN(this.right) ? rect.dRight - left : this.right - left; double height = Double.IsNaN(this.bottom) ? (rect.dBottom - top) : (this.bottom - top); return(new PdfSourceRect(left, top, Math.Max(width, 0.0), Math.Max(height, 0.0))); }
public PdfTextFragment(PdfDocument.NativeTextFragment frag, int pageNo, PdfTextFragment previousTextFragment) { rectOnUnrotatedPage = new PdfSourceRect(frag.m_dX, frag.m_dY, frag.m_dWidth, frag.m_dHeight); text = frag.m_szTextA; this.pageNo = pageNo; _lastOnLine = this; glyphPositions = new double[frag.m_nGlyphPositionSize]; Array.Copy(frag.m_pdGlyphPosition, glyphPositions, frag.m_nGlyphPositionSize); //if firstOnLine is entirely above this if (previousTextFragment == null || previousTextFragment.FirstOnLine.RectOnUnrotatedPage.dY > this.RectOnUnrotatedPage.dBottom) { _firstOnLine = this; } else { _firstOnLine = previousTextFragment.FirstOnLine; previousTextFragment._lastOnLine = this; } }