1

I'd like to get bounding box of pdf objects (text and vectorial) but i get strange results

 For i As Integer = 0 To renderInfo.SegmentData.Count - 2 Step 2
        Dim x As Single = renderInfo.SegmentData(i)
        Dim y As Single = renderInfo.SegmentData(i + 1)
        Dim a As parser.Vector = New parser.Vector(x, y, 1).Cross(renderInfo.Ctm)
        x = a(parser.Vector.I1)
        y = a(parser.Vector.I2)
        lastRect = New System.util.RectangleJ(x, y, 0, 0)
        If Not IsNothing(lastRect) Then
            If lastRect.X < minX Then
                minX = lastRect.X
            End If
            If lastRect.X > maxX Then
                maxX = lastRect.X
            End If
            If lastRect.Y < minY Then
                minY = lastRect.Y
            End If
            If lastRect.Y > maxY Then
                maxY = lastRect.Y
            End If
        End If
    Next

This is the core of my ModifyPath implementation, it works with some PDFs but it doesn't work with few ones (like this). I'd like to get the same values as GhostScript BoundingBox data : 67 376 561 746

Any ideas?

d.mercanti
  • 11
  • 4
  • The `SegmentData` are **not** only coordinates of corners of the graph, they can also be width and height information (**re**ctangle instruction) or they can be positions of cubic Bézier curve control points (**c**, **v**, **y** instructions). Thus, you must interpret the data in the context of their instruction. – mkl Nov 15 '17 at 10:58

0 Answers0