2017-05-03 51 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 
相關問題