2017-05-03 50 views
-3

我想从pdf中提取图像,使用pdf miner module.I想要将图形图像提取为单个图像,但实际上模块没有返回整个图形图像,而是返回我将PDF转换为ppt.然后手动将图形图像分组为单个图像,然后再转换为pdf。现在,pdf矿工正在将图形图像提取为单个图像。如何以编程方式对Power Point图像进行分组

手动就可以组电源点images.Is有没有办法做到这一点编程

+0

你在说MS Powerpoint吗?如果真的这样看待使用内置的VBA。如果没有,那么也许你应该扩大你的要求。另外提到你已经尝试过。 –

+0

是MS Powerpint.i已经解释了我的问题。 – mani

回答

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 
相关问题