我正在尝试使用pdf miner模块从pdf中提取图像。我想将图形图像提取为单个图像,但实际上模块没有返回整个图形图像而是返回分离的图像。我已经转换了pdf到ppt.Then手动将图形图像分组为单个图像,然后再次转换为pdf。现在pdf矿工正在将图形图像提取为单个图像。
手动我们可以对功率点图像进行分组。有没有办法以编程方式执行此操作
答案 0 :(得分:1)
为了做到这一点,你需要能够提供一些能够独特识别你的形状的条件;它们可能是幻灯片上唯一的图片形状,其他空白幻灯片上的唯一形状,或者在您首次获得幻灯片上的形状数量后添加的任何形状。一旦你有条件你可以应用这可以构建一个满足条件的形状数组,然后将它们分组:
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