Пример #1
0
        public void DisplayLetters()
        {
            if (PagePlotModel == null)
            {
                return;
            }

            foreach (var s in PagePlotModel.Series.Where(s => (string)s.Tag == "letter").ToList())
            {
                PagePlotModel.Series.Remove(s);
            }

            foreach (var letter in _pdfPageModel.GetLetters())
            {
                var series1 = new LineSeries {
                    Tag = "letter", Title = GetShorterText(letter.Value), LineStyle = LineStyle.Solid, Color = OxyColors.Blue
                };
                var bbox = letter.GlyphRectangle;
                series1.Points.Add(PdfDocumentModel.ToDataPoint(bbox.BottomLeft));
                series1.Points.Add(PdfDocumentModel.ToDataPoint(bbox.BottomRight));
                series1.Points.Add(PdfDocumentModel.ToDataPoint(bbox.TopRight));
                series1.Points.Add(PdfDocumentModel.ToDataPoint(bbox.TopLeft));
                series1.Points.Add(PdfDocumentModel.ToDataPoint(bbox.BottomLeft));
                PagePlotModel.Series.Add(series1);
            }

            PagePlotModel.InvalidatePlot(true);
        }
Пример #2
0
            public PageInfoModel(PdfPageModel pdfPageModel)
            {
                this.pdfPageModel = pdfPageModel;
                var filteredLetters = pdfPageModel.GetLetters().Where(l => !string.IsNullOrEmpty(l.Value.Trim())).ToList();

                HeightDistribution = new Distribution(filteredLetters.Select(l => l.GlyphRectangle.Height));
                WidthDistribution  = new Distribution(filteredLetters.Select(l => l.GlyphRectangle.Width));
            }