-3

I'm trying to extract the images from pdf using pdf miner module.I want to extract the graph image as single image but actually module is not returning the whole graph image instead its returning the separated images.I have converted the pdf to ppt.Then manually grouped the graphic image as single image then again converted to pdf. Now pdf miner is extracting the graph image as single image.

Manually we can group the power point images.Is there any way to do that programmatically

mani
  • 15
  • 1
  • 5
  • Are you talking MS Powerpoint? If so look into using the built in VBA. If not then maybe you should expand on what it is you're asking. Also mention what you've tried. – Keef Baker May 03 '17 at 07:15
  • yes MS Powerpint.i have explained about my issue. – mani May 03 '17 at 07:33

1 Answers1

1

In order to do this, you need to be able to supply some condition that will identify your shapes uniquely; they might be the only picture shapes on a slide, the only shapes on an otherwise blank slide, or any shapes added after you've first gotten a count of the number of shapes on the slide. Once you have a condition you can apply this can build an array of the shapes that meet the condition then group them:

Sub GroupCertainShapes()

    Dim x As Long
    Dim sTemp As String
    Dim aShapeList() As String
    Dim lShapeCount As Long

    With ActivePresentation.Slides(1)
        ' iterate through all shapes on the slide
        ' to get a count of shapes that meet our condition
        For x = 1 To .Shapes.Count
            ' Does the shape meet our condition? count it.
            If .Shapes(x).Type = msoAutoShape Then
                lShapeCount = lShapeCount + 1
            End If
        Next

        ' now we know how many elements to include in our array,
        ' so redim it:
        ReDim aShapeList(1 To lShapeCount)

        ' Reset the shape counter
        lShapeCount = 0

        ' Now add the shapes that meet our condition
        ' to the array:
        For x = 1 To .Shapes.Count
            ' apply some criterion for including the shape or not
            If .Shapes(x).Type = msoAutoShape Then
                lShapeCount = lShapeCount + 1
                aShapeList(lShapeCount) = .Shapes(x).Name
            End If
        Next

        ' and finally form a group from the shapes in the array:
        If UBound(aShapeList) > 0 Then
            .Shapes.Range(aShapeList).Group
        End If

    End With
End Sub
Steve Rindsberg
  • 14,442
  • 1
  • 29
  • 34